Skip to content

Commit

Permalink
Fixed SDWebImageCombinedOperation cancel crash (#798 #809)
Browse files Browse the repository at this point in the history
  • Loading branch information
bpoplauschi committed Jul 21, 2014
1 parent c8df858 commit 28109c4
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 28109c4

Please sign in to comment.