Have ASMultiplexImageNode store its image request operation weakly

This commit is contained in:
Adlai Holler 2015-10-06 13:21:42 -07:00
parent f0b7e150cd
commit fffc76a353

View File

@ -66,7 +66,7 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent
id _loadedImageIdentifier; id _loadedImageIdentifier;
id _loadingImageIdentifier; id _loadingImageIdentifier;
id _displayedImageIdentifier; id _displayedImageIdentifier;
NSOperation *_phImageRequestOperation; __weak NSOperation *_phImageRequestOperation;
// Networking. // Networking.
id _downloadIdentifier; id _downloadIdentifier;
@ -547,7 +547,7 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent
[_phImageRequestOperation cancel]; [_phImageRequestOperation cancel];
__weak __typeof(self)weakSelf = self; __weak __typeof(self)weakSelf = self;
_phImageRequestOperation = [NSBlockOperation blockOperationWithBlock:^{ NSOperation *newImageRequestOp = [NSBlockOperation blockOperationWithBlock:^{
__strong __typeof(weakSelf)strongSelf = weakSelf; __strong __typeof(weakSelf)strongSelf = weakSelf;
if (strongSelf == nil) { return; } if (strongSelf == nil) { return; }
@ -590,7 +590,8 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent
} }
}]; }];
}]; }];
[phImageRequestQueue addOperation:_phImageRequestOperation]; _phImageRequestOperation = newImageRequestOp;
[phImageRequestQueue addOperation:newImageRequestOp];
} }
- (void)_fetchImageWithIdentifierFromCache:(id)imageIdentifier URL:(NSURL *)imageURL completion:(void (^)(UIImage *image))completionBlock - (void)_fetchImageWithIdentifierFromCache:(id)imageIdentifier URL:(NSURL *)imageURL completion:(void (^)(UIImage *image))completionBlock