[Bf-blender-cvs] [92e41bb1a8a] master: Fix for fix (c) assert from own recent commit.

Bastien Montagne noreply at git.blender.org
Thu Feb 13 16:56:39 CET 2020


Commit: 92e41bb1a8a540e8f1f5abdd4127647815ebb22c
Author: Bastien Montagne
Date:   Thu Feb 13 16:54:44 2020 +0100
Branches: master
https://developer.blender.org/rB92e41bb1a8a540e8f1f5abdd4127647815ebb22c

Fix for fix (c) assert from own recent commit.

This master_collection thing is really, really annoyingly spreading all
over the place...

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

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

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

diff --git a/source/blender/blenkernel/intern/lib_query.c b/source/blender/blenkernel/intern/lib_query.c
index 4b075520b21..2cd45d1486f 100644
--- a/source/blender/blenkernel/intern/lib_query.c
+++ b/source/blender/blenkernel/intern/lib_query.c
@@ -338,7 +338,13 @@ static void library_foreach_bone(LibraryForeachIDData *data, Bone *bone)
 static void library_foreach_layer_collection(LibraryForeachIDData *data, ListBase *lb)
 {
   for (LayerCollection *lc = lb->first; lc; lc = lc->next) {
-    FOREACH_CALLBACK_INVOKE(data, lc->collection, IDWALK_CB_NOP);
+    /* XXX This is very weak. The whole idea of keeping pointers to private IDs is very bad
+     * anyway... */
+    const int cb_flag = (lc->collection != NULL &&
+                         (lc->collection->id.flag & LIB_PRIVATE_DATA) != 0) ?
+                            IDWALK_CB_PRIVATE :
+                            IDWALK_CB_NOP;
+    FOREACH_CALLBACK_INVOKE(data, lc->collection, cb_flag);
     library_foreach_layer_collection(data, &lc->layer_collections);
   }
 
@@ -356,7 +362,14 @@ static void library_foreach_collection(LibraryForeachIDData *data, Collection *c
     FOREACH_CALLBACK_INVOKE(data, child->collection, IDWALK_CB_NEVER_SELF | IDWALK_CB_USER);
   }
   for (CollectionParent *parent = collection->parents.first; parent; parent = parent->next) {
-    FOREACH_CALLBACK_INVOKE(data, parent->collection, IDWALK_CB_NEVER_SELF | IDWALK_CB_LOOPBACK);
+    /* XXX This is very weak. The whole idea of keeping pointers to private IDs is very bad
+     * anyway... */
+    const int cb_flag = ((parent->collection != NULL &&
+                          (parent->collection->id.flag & LIB_PRIVATE_DATA) != 0) ?
+                             IDWALK_CB_PRIVATE :
+                             IDWALK_CB_NOP);
+    FOREACH_CALLBACK_INVOKE(
+        data, parent->collection, IDWALK_CB_NEVER_SELF | IDWALK_CB_LOOPBACK | cb_flag);
   }
 
   FOREACH_FINALIZE_VOID;



More information about the Bf-blender-cvs mailing list