Merge pull request #2954 from dreampiggy/fix_rare_case_cancel_double_callback
Fix the rare case when call `SDWebImageDownloaderOperation.cancel`, the completion block may callback twice
This commit is contained in:
commit
f4548bba5c
|
@ -245,9 +245,10 @@ typedef NSMutableDictionary<NSString *, id> SDCallbacksDictionary;
|
|||
// maintain the isFinished and isExecuting flags.
|
||||
if (self.isExecuting) self.executing = NO;
|
||||
if (!self.isFinished) self.finished = YES;
|
||||
}
|
||||
} else {
|
||||
// Operation cancelled by user during sending the request
|
||||
[self callCompletionBlocksWithError:[NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorCancelled userInfo:@{NSLocalizedDescriptionKey : @"Operation cancelled by user during sending the request"}]];
|
||||
}
|
||||
|
||||
[self reset];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue