Wraps transaction async dispatches with autorelease pools.

This commit is contained in:
René Cacheaux
2014-10-07 15:25:04 -05:00
parent bd612fd725
commit 7ea0963b65

View File

@@ -87,12 +87,14 @@
ASDisplayNodeAsyncTransactionOperation *operation = [[ASDisplayNodeAsyncTransactionOperation alloc] initWithOperationCompletionBlock:completion];
[_operations addObject:operation];
dispatch_group_async(_group, queue, ^{
if (_state != ASAsyncTransactionStateCanceled) {
dispatch_group_enter(_group);
block(^(id<NSObject> value){
operation.value = value;
dispatch_group_leave(_group);
});
@autoreleasepool {
if (_state != ASAsyncTransactionStateCanceled) {
dispatch_group_enter(_group);
block(^(id<NSObject> value){
operation.value = value;
dispatch_group_leave(_group);
});
}
}
});
}
@@ -109,8 +111,10 @@
ASDisplayNodeAsyncTransactionOperation *operation = [[ASDisplayNodeAsyncTransactionOperation alloc] initWithOperationCompletionBlock:completion];
[_operations addObject:operation];
dispatch_group_async(_group, queue, ^{
if (_state != ASAsyncTransactionStateCanceled) {
operation.value = block();
@autoreleasepool {
if (_state != ASAsyncTransactionStateCanceled) {
operation.value = block();
}
}
});
}