Skip to content

Commit

Permalink
Fixed SDWebImageCombinedOperation cancel crash (SDWebImage#798 SDWebI…
Browse files Browse the repository at this point in the history
  • Loading branch information
bpoplauschi authored and devedup committed Sep 10, 2014
1 parent 53b772c commit 683b35b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions SDWebImage/SDWebImageManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,13 @@ - (BOOL)isRunning {
@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];
}
}
Expand Down

0 comments on commit 683b35b

Please sign in to comment.