Fixed retain cycles in AFImageRequestOperation.m and AFHTTPClient.m caused by strong references within blocks
These retain cycles started showing up as compiler warnings after upgrading to Xcode 4.6DP
This commit is contained in:
parent
eaac6a1759
commit
3175869333
2 changed files with 4 additions and 3 deletions
|
|
@ -566,8 +566,9 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) {}
|
|||
|
||||
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();
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ static dispatch_queue_t image_request_operation_processing_queue() {
|
|||
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 @@ static dispatch_queue_t image_request_operation_processing_queue() {
|
|||
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);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue