Fix crash on file load in unregistering bke::AssetLibraryService

Use mutable iterator to support callbacks removing themselves.
This commit is contained in:
Campbell Barton 2021-10-19 13:20:48 +11:00
parent c4f733a76c
commit da949c3574
1 changed files with 2 additions and 3 deletions

View File

@ -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);
}
}