1
1

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:
2021-11-04 20:58:32 -07:00
parent 1b6238edba
commit 7061d1e39f

View File

@@ -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);
}