mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Add locking around setting weakCacheEntry ivar (#2812)
This commit is contained in:
committed by
Adlai Holler
parent
3506cec1c0
commit
ecef8edfdd
@@ -379,7 +379,11 @@ struct ASImageNodeDrawParameters {
|
||||
if (entry == nil) { // If nil, we were cancelled.
|
||||
return nil;
|
||||
}
|
||||
_weakCacheEntry = entry; // Retain so that the entry remains in the weak cache
|
||||
|
||||
__instanceLock__.lock();
|
||||
_weakCacheEntry = entry; // Retain so that the entry remains in the weak cache
|
||||
__instanceLock__.unlock();
|
||||
|
||||
return entry.value;
|
||||
}
|
||||
|
||||
@@ -523,9 +527,11 @@ static ASDN::Mutex cacheLock;
|
||||
|
||||
- (void)clearContents
|
||||
{
|
||||
[super clearContents];
|
||||
[super clearContents];
|
||||
|
||||
__instanceLock__.lock();
|
||||
_weakCacheEntry = nil; // release contents from the cache.
|
||||
__instanceLock__.unlock();
|
||||
}
|
||||
|
||||
#pragma mark - Cropping
|
||||
|
||||
Reference in New Issue
Block a user