...
|
...
|
@@ -228,11 +228,14 @@ |
|
|
[self safelyRemoveOperationFromRunning:strongOperation];
|
|
|
}
|
|
|
}];
|
|
|
@synchronized(operation) {
|
|
|
// Need same lock to ensure cancelBlock called because cancel method can be called in different queue
|
|
|
operation.cancelBlock = ^{
|
|
|
[self.imageDownloader cancel:subOperationToken];
|
|
|
__strong __typeof(weakOperation) strongOperation = weakOperation;
|
|
|
[self safelyRemoveOperationFromRunning:strongOperation];
|
|
|
};
|
|
|
}
|
|
|
} else if (cachedImage) {
|
|
|
__strong __typeof(weakOperation) strongOperation = weakOperation;
|
|
|
[self callCompletionBlockForOperation:strongOperation completion:completedBlock image:cachedImage data:cachedData error:nil cacheType:cacheType finished:YES url:url];
|
...
|
...
|
@@ -319,6 +322,7 @@ |
|
|
}
|
|
|
|
|
|
- (void)cancel {
|
|
|
@synchronized(self) {
|
|
|
self.cancelled = YES;
|
|
|
if (self.cacheOperation) {
|
|
|
[self.cacheOperation cancel];
|
...
|
...
|
@@ -326,11 +330,8 @@ |
|
|
}
|
|
|
if (self.cancelBlock) {
|
|
|
self.cancelBlock();
|
|
|
|
|
|
// TODO: this is a temporary fix to #809.
|
|
|
// Until we can figure the exact cause of the crash, going with the ivar instead of the setter
|
|
|
// self.cancelBlock = nil;
|
|
|
_cancelBlock = nil;
|
|
|
self.cancelBlock = nil;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
|