Revert operation remove logic

This commit is contained in:
zhongwuzw 2018-07-18 23:07:25 +08:00
parent 7f1440bc96
commit 593feb664c
1 changed files with 8 additions and 3 deletions

View File

@ -46,12 +46,17 @@ typedef NSMapTable<NSString *, id<SDWebImageOperation>> SDOperationsDictionary;
// Cancel in progress downloader from queue
SDOperationsDictionary *operationDictionary = [self sd_operationDictionary];
id<SDWebImageOperation> operation;
@synchronized (self) {
operation = [operationDictionary objectForKey:key];
[operationDictionary removeObjectForKey:key];
}
if ([operation conformsToProtocol:@protocol(SDWebImageOperation)]) {
[operation cancel];
if (operation) {
if ([operation conformsToProtocol:@protocol(SDWebImageOperation)]) {
[operation cancel];
}
@synchronized (self) {
[operationDictionary removeObjectForKey:key];
}
}
}
}