[Bf-blender-cvs] [0564b19ff4d] blender-v3.0-release: Cleanup: Correct order of guard and lock in moviecache_valfree

Jesse Yurkovich noreply at git.blender.org
Tue Jan 11 09:32:59 CET 2022


Commit: 0564b19ff4dd489a45f639bc2d360a0b586317bf
Author: Jesse Yurkovich
Date:   Fri Nov 12 20:47:26 2021 -0800
Branches: blender-v3.0-release
https://developer.blender.org/rB0564b19ff4dd489a45f639bc2d360a0b586317bf

Cleanup: Correct order of guard and lock in moviecache_valfree

Fix own mistake in rB7061d1e39fe

In my attempt to quickly address T92838, along with the original bug, I
made a nonsensical choice to use the limiter lock to guard the check
against the cache item itself. While harmless, it is not necessary and
semantically wrong / potentially confusing to future readers of the code.

Differential Revision: https://developer.blender.org/D13122

===================================================================

M	source/blender/imbuf/intern/moviecache.c

===================================================================

diff --git a/source/blender/imbuf/intern/moviecache.c b/source/blender/imbuf/intern/moviecache.c
index 1bc0a4e628d..8923ba98e08 100644
--- a/source/blender/imbuf/intern/moviecache.c
+++ b/source/blender/imbuf/intern/moviecache.c
@@ -122,11 +122,11 @@ static void moviecache_valfree(void *val)
 
   PRINT("%s: cache '%s' free item %p buffer %p\n", __func__, cache->name, item, item->ibuf);
 
-  BLI_mutex_lock(&limitor_lock);
   if (item->c_handle) {
+    BLI_mutex_lock(&limitor_lock);
     MEM_CacheLimiter_unmanage(item->c_handle);
+    BLI_mutex_unlock(&limitor_lock);
   }
-  BLI_mutex_unlock(&limitor_lock);
 
   if (item->ibuf) {
     IMB_freeImBuf(item->ibuf);



More information about the Bf-blender-cvs mailing list