Fixed SDWebImageCombinedOperation cancel crash (#798 #809)

This commit is contained in:
Bogdan Poplauschi 2014-07-21 15:27:16 +03:00
parent c8df858f75
commit 28109c4c70
1 changed files with 6 additions and 3 deletions

View File

@ -298,10 +298,13 @@
@implementation SDWebImageCombinedOperation
- (void)setCancelBlock:(SDWebImageNoParamsBlock)cancelBlock {
// check if the operation is already cancelled, then we just call the cancelBlock
if (self.isCancelled) {
if (cancelBlock) cancelBlock();
}
else {
if (cancelBlock) {
cancelBlock();
}
_cancelBlock = nil; // don't forget to nil the cancelBlock, otherwise we will get crashes
} else {
_cancelBlock = [cancelBlock copy];
}
}