Fix T92740: Missing lock around the image CacheLimiter
A recent change exposed this long-standing race. Simply protect the MEM_CacheLimiter with its lock now. Additionally, guard against unmanaging an already destroyed cache handle. Ref T92740, T92838
This commit is contained in:
@@ -122,7 +122,12 @@ static void moviecache_valfree(void *val)
|
||||
|
||||
PRINT("%s: cache '%s' free item %p buffer %p\n", __func__, cache->name, item, item->ibuf);
|
||||
|
||||
MEM_CacheLimiter_unmanage(item->c_handle);
|
||||
BLI_mutex_lock(&limitor_lock);
|
||||
if (item->c_handle) {
|
||||
MEM_CacheLimiter_unmanage(item->c_handle);
|
||||
}
|
||||
BLI_mutex_unlock(&limitor_lock);
|
||||
|
||||
if (item->ibuf) {
|
||||
IMB_freeImBuf(item->ibuf);
|
||||
}
|
||||
|
Reference in New Issue
Block a user