diff --git a/AFNetworking/AFHTTPClient.m b/AFNetworking/AFHTTPClient.m index 96a7060..e3439da 100644 --- a/AFNetworking/AFHTTPClient.m +++ b/AFNetworking/AFHTTPClient.m @@ -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(); diff --git a/AFNetworking/AFImageRequestOperation.m b/AFNetworking/AFImageRequestOperation.m index f4f724a..5c24c79 100644 --- a/AFNetworking/AFImageRequestOperation.m +++ b/AFNetworking/AFImageRequestOperation.m @@ -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); }); });