[Bf-blender-cvs] [da949c35740] master: Fix crash on file load in unregistering bke::AssetLibraryService

Campbell Barton noreply at git.blender.org
Tue Oct 19 04:24:41 CEST 2021


Commit: da949c357405ad01b00e83177335f55d113a8619
Author: Campbell Barton
Date:   Tue Oct 19 13:20:48 2021 +1100
Branches: master
https://developer.blender.org/rBda949c357405ad01b00e83177335f55d113a8619

Fix crash on file load in unregistering bke::AssetLibraryService

Use mutable iterator to support callbacks removing themselves.

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

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

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

diff --git a/source/blender/blenkernel/intern/callbacks.c b/source/blender/blenkernel/intern/callbacks.c
index 87d5961b12e..7fd3048b740 100644
--- a/source/blender/blenkernel/intern/callbacks.c
+++ b/source/blender/blenkernel/intern/callbacks.c
@@ -35,10 +35,9 @@ void BKE_callback_exec(struct Main *bmain,
                        const int num_pointers,
                        eCbEvent evt)
 {
+  /* Use mutable iteration so handlers are able to remove themselves. */
   ListBase *lb = &callback_slots[evt];
-  bCallbackFuncStore *funcstore;
-
-  for (funcstore = lb->first; funcstore; funcstore = funcstore->next) {
+  LISTBASE_FOREACH_MUTABLE (bCallbackFuncStore *, funcstore, lb) {
     funcstore->func(bmain, pointers, num_pointers, funcstore->arg);
   }
 }



More information about the Bf-blender-cvs mailing list