diff options
author | Jesse Yurkovich <jesse.y@gmail.com> | 2021-11-05 06:58:32 +0300 |
---|---|---|
committer | Jesse Yurkovich <jesse.y@gmail.com> | 2021-11-05 06:58:32 +0300 |
commit | 7061d1e39fea7495e787a071b83757e3dc0d61a7 (patch) | |
tree | e28d3352326a437ee00139413d19ed80cb57dc31 /source/blender/imbuf/intern | |
parent | 1b6238edbaa886f68b93a7dddea3c413cf7626c1 (diff) |
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
Diffstat (limited to 'source/blender/imbuf/intern')
-rw-r--r-- | source/blender/imbuf/intern/moviecache.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/imbuf/intern/moviecache.c b/source/blender/imbuf/intern/moviecache.c index 6e7b85a300a..34c180ba1fb 100644 --- a/source/blender/imbuf/intern/moviecache.c +++ b/source/blender/imbuf/intern/moviecache.c @@ -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); } |