Merge pull request #2574 from zhongwuzw/fix-operation-creation-race-condition
Fix race condition for creation of download operation when isCancelled is YES but isFinished is NO
This commit is contained in:
commit
60f4365420
|
@ -289,8 +289,8 @@
|
|||
|
||||
LOCK(self.operationsLock);
|
||||
NSOperation<SDWebImageDownloaderOperationInterface> *operation = [self.URLOperations objectForKey:url];
|
||||
// There is a case that the operation may be marked as finished, but not been removed from `self.URLOperations`.
|
||||
if (!operation || operation.isFinished) {
|
||||
// There is a case that the operation may be marked as finished or cancelled, but not been removed from `self.URLOperations`.
|
||||
if (!operation || operation.isFinished || operation.isCancelled) {
|
||||
operation = [self createDownloaderOperationWithUrl:url options:options];
|
||||
__weak typeof(self) wself = self;
|
||||
operation.completionBlock = ^{
|
||||
|
|
Loading…
Reference in New Issue