mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
Cancel image requests in ASMultiplexImageNode.clearFetchedData
This commit is contained in:
@@ -170,7 +170,8 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent
|
|||||||
return [self initWithCache:nil downloader:nil]; // satisfy compiler
|
return [self initWithCache:nil downloader:nil]; // satisfy compiler
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc {
|
- (void)dealloc
|
||||||
|
{
|
||||||
[_phImageRequestOperation cancel];
|
[_phImageRequestOperation cancel];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,10 +181,7 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent
|
|||||||
[super clearContents]; // This actually clears the contents, so we need to do this first for our displayedImageIdentifier to be meaningful.
|
[super clearContents]; // This actually clears the contents, so we need to do this first for our displayedImageIdentifier to be meaningful.
|
||||||
[self _setDisplayedImageIdentifier:nil withImage:nil];
|
[self _setDisplayedImageIdentifier:nil withImage:nil];
|
||||||
|
|
||||||
if (_phImageRequestOperation) {
|
|
||||||
[_phImageRequestOperation cancel];
|
[_phImageRequestOperation cancel];
|
||||||
_phImageRequestOperation = nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_downloadIdentifier) {
|
if (_downloadIdentifier) {
|
||||||
[_downloader cancelImageDownloadForIdentifier:_downloadIdentifier];
|
[_downloader cancelImageDownloadForIdentifier:_downloadIdentifier];
|
||||||
@@ -196,6 +194,14 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent
|
|||||||
[super clearFetchedData];
|
[super clearFetchedData];
|
||||||
|
|
||||||
if ([self _shouldClearFetchedImageData]) {
|
if ([self _shouldClearFetchedImageData]) {
|
||||||
|
|
||||||
|
[_phImageRequestOperation cancel];
|
||||||
|
|
||||||
|
if (_downloadIdentifier) {
|
||||||
|
[_downloader cancelImageDownloadForIdentifier:_downloadIdentifier];
|
||||||
|
_downloadIdentifier = nil;
|
||||||
|
}
|
||||||
|
|
||||||
// setting this to nil makes the node fetch images the next time its display starts
|
// setting this to nil makes the node fetch images the next time its display starts
|
||||||
_loadedImageIdentifier = nil;
|
_loadedImageIdentifier = nil;
|
||||||
self.image = nil;
|
self.image = nil;
|
||||||
|
|||||||
Reference in New Issue
Block a user