[Bf-blender-cvs] [709831e5dd3] asset-browser: Fix thread-lock when re-generating material preview icon

Julian Eisel noreply at git.blender.org
Mon Nov 30 11:41:30 CET 2020


Commit: 709831e5dd3d315ef6f94414eea823b27f27497d
Author: Julian Eisel
Date:   Mon Nov 30 11:40:24 2020 +0100
Branches: asset-browser
https://developer.blender.org/rB709831e5dd3d315ef6f94414eea823b27f27497d

Fix thread-lock when re-generating material preview icon

Thought the spin lock supported recursion, it doesn't.

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

M	source/blender/blenkernel/intern/icons.c

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

diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c
index 27c05630a0a..16cf3028e1d 100644
--- a/source/blender/blenkernel/intern/icons.c
+++ b/source/blender/blenkernel/intern/icons.c
@@ -176,8 +176,9 @@ static int get_next_free_id(void)
     return next_id;
   }
 
-  /* now we try to find the smallest icon id not stored in the gIcons hash */
-  while (icon_ghash_lookup(startId) && startId >= gFirstIconId) {
+  /* Now we try to find the smallest icon id not stored in the gIcons hash.
+   * Don't use icon_ghash_lookup here, it would lock recursively (thread-lock). */
+  while (BLI_ghash_lookup(gIcons, POINTER_FROM_INT(startId)) && startId >= gFirstIconId) {
     startId++;
   }
 
@@ -675,7 +676,6 @@ void BKE_icon_changed(const int icon_id)
     return;
   }
 
-  BLI_spin_lock(&gIconMutex);
   icon = icon_ghash_lookup(icon_id);
 
   if (icon) {
@@ -696,8 +696,6 @@ void BKE_icon_changed(const int icon_id)
       }
     }
   }
-
-  BLI_spin_unlock(&gIconMutex);
 }
 
 static Icon *icon_create(int icon_id, int obj_type, void *obj)



More information about the Bf-blender-cvs mailing list