Browse files

Merge pull request #655 from nsforge/master

Fixed retain cycles that the Xcode4.6DP compiler detected
  • Loading branch information...
2 parents 732cd2d + 3175869 commit 4fd322e52dbaefc51f05df95da802f548aa3c37f @mattt mattt committed Dec 26, 2012
Showing with 4 additions and 3 deletions.
  1. +2 −1 AFNetworking/AFHTTPClient.m
  2. +2 −2 AFNetworking/AFImageRequestOperation.m
View
3 AFNetworking/AFHTTPClient.m
@@ -571,8 +571,9 @@ - (void)enqueueBatchOfHTTPRequestOperations:(NSArray *)operations
for (AFHTTPRequestOperation *operation in operations) {
AFCompletionBlock originalCompletionBlock = [operation.completionBlock copy];
+ __weak AFHTTPRequestOperation *weakOperation = operation;
operation.completionBlock = ^{
- dispatch_queue_t queue = operation.successCallbackQueue ?: dispatch_get_main_queue();
+ dispatch_queue_t queue = weakOperation.successCallbackQueue ?: dispatch_get_main_queue();
dispatch_group_async(dispatchGroup, queue, ^{
if (originalCompletionBlock) {
originalCompletionBlock();
View
4 AFNetworking/AFImageRequestOperation.m
@@ -82,7 +82,7 @@ + (AFImageRequestOperation *)imageRequestOperationWithRequest:(NSURLRequest *)ur
dispatch_async(image_request_operation_processing_queue(), ^(void) {
UIImage *processedImage = imageProcessingBlock(image);
- dispatch_async(requestOperation.successCallbackQueue ?: dispatch_get_main_queue(), ^(void) {
+ dispatch_async(operation.successCallbackQueue ?: dispatch_get_main_queue(), ^(void) {
success(operation.request, operation.response, processedImage);
});
});
@@ -113,7 +113,7 @@ + (AFImageRequestOperation *)imageRequestOperationWithRequest:(NSURLRequest *)ur
dispatch_async(image_request_operation_processing_queue(), ^(void) {
NSImage *processedImage = imageProcessingBlock(image);
- dispatch_async(requestOperation.successCallbackQueue ?: dispatch_get_main_queue(), ^(void) {
+ dispatch_async(operation.successCallbackQueue ?: dispatch_get_main_queue(), ^(void) {
success(operation.request, operation.response, processedImage);
});
});

0 comments on commit 4fd322e

Please sign in to comment.