Add locking around setting weakCacheEntry ivar (#2812)

This commit is contained in:
Chris Danford
2016-12-21 10:14:14 -08:00
committed by Adlai Holler
parent 3506cec1c0
commit ecef8edfdd

View File

@@ -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