Copy all stored blocks

This commit is contained in:
Olivier Poitrey 2012-11-09 11:05:18 +01:00
parent 8f50bf6322
commit 7b947163da
3 changed files with 10 additions and 10 deletions

View File

@ -151,8 +151,8 @@ NSString *const kCompletedCallbackKey = @"completed";
// Handle single download of simultaneous download request for the same URL
NSMutableArray *callbacksForURL = self.URLCallbacks[url];
NSMutableDictionary *callbacks = NSMutableDictionary.new;
if (progressBlock) callbacks[kProgressCallbackKey] = progressBlock;
if (completedBlock) callbacks[kCompletedCallbackKey] = completedBlock;
if (progressBlock) callbacks[kProgressCallbackKey] = [progressBlock copy];
if (completedBlock) callbacks[kCompletedCallbackKey] = [completedBlock copy];
[callbacksForURL addObject:callbacks];
self.URLCallbacks[url] = callbacksForURL;

View File

@ -12,9 +12,9 @@
@interface SDWebImageDownloaderOperation ()
@property (strong, nonatomic) SDWebImageDownloaderProgressBlock progressBlock;
@property (strong, nonatomic) SDWebImageDownloaderCompletedBlock completedBlock;
@property (strong, nonatomic) void (^cancelBlock)();
@property (copy, nonatomic) SDWebImageDownloaderProgressBlock progressBlock;
@property (copy, nonatomic) SDWebImageDownloaderCompletedBlock completedBlock;
@property (copy, nonatomic) void (^cancelBlock)();
@property (assign, nonatomic, getter = isExecuting) BOOL executing;
@property (assign, nonatomic, getter = isFinished) BOOL finished;
@ -37,9 +37,9 @@
_queue = queue;
_request = request;
_options = options;
_progressBlock = progressBlock;
_completedBlock = completedBlock;
_cancelBlock = cancelBlock;
_progressBlock = [progressBlock copy];
_completedBlock = [completedBlock copy];
_cancelBlock = [cancelBlock copy];
_executing = NO;
_finished = NO;
_expectedSize = 0;

View File

@ -12,7 +12,7 @@
@interface SDWebImageCombinedOperation : NSObject <SDWebImageOperation>
@property (assign, nonatomic, getter = isCancelled) BOOL cancelled;
@property (strong, nonatomic) void (^cancelBlock)();
@property (copy, nonatomic) void (^cancelBlock)();
@end
@ -146,7 +146,7 @@
}
else
{
_cancelBlock = cancelBlock;
_cancelBlock = [cancelBlock copy];
}
}