Merge pull request #2642 from zhongwuzw/break_retain_of_prefetch_block

Break strong retain cycle for prefetch block
This commit is contained in:
DreamPiggy 2019-03-16 11:01:58 +08:00 committed by GitHub
commit d76dd081ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -107,7 +107,11 @@
for (NSURL *url in token.urls) {
__weak typeof(self) wself = self;
SDAsyncBlockOperation *prefetchOperation = [SDAsyncBlockOperation blockOperationWithBlock:^(SDAsyncBlockOperation * _Nonnull asyncOperation) {
id<SDWebImageOperation> operation = [self.manager loadImageWithURL:url options:self.options context:self.context progress:nil completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) {
__strong typeof(wself) strongSelf = wself;
if (!strongSelf) {
return;
}
id<SDWebImageOperation> operation = [strongSelf.manager loadImageWithURL:url options:strongSelf.options context:strongSelf.context progress:nil completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) {
__strong typeof(wself) sself = wself;
if (!sself) {
return;