Fix race condition for creation of download operation when isCancelled is YES but isFinished is NO
Fix race condition for creation of download operation when isCancelled is YES but isFinished is NO update comment
This commit is contained in:
parent
c95be0994e
commit
6becff0f06
|
@ -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