Commit: ff5630b7fafec56d9b1187ee42e8b786b62cb498
Author: Jesse Yurkovich
Date: Thu Nov 4 20:58:32 2021 -0700
Branches: blender-v3.0-release
https://developer.blender.org/rBff5630b7fafec56d9b1187ee42e8b786b62cb498
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
===================================================================
M source/blender/imbuf/intern/moviecache.c
===================================================================
diff --git a/source/blender/imbuf/intern/moviecache.c
b/source/blender/imbuf/intern/moviecache.c
index 4f316150e10..1bc0a4e628d 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);
}
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs