[Bf-blender-cvs] [36184f73926] blender2.8: Fix T57816: Crash when deleting recently orphaned collection

Dalai Felinto noreply at git.blender.org
Fri Dec 21 11:07:18 CET 2018


Commit: 36184f739264387a932c21424964d01c33d793b0
Author: Dalai Felinto
Date:   Tue Dec 18 20:36:57 2018 -0200
Branches: blender2.8
https://developer.blender.org/rB36184f739264387a932c21424964d01c33d793b0

Fix T57816: Crash when deleting recently orphaned collection

We were never removing the parent collection from a collection upon removal
of the parent.

Reviewers: mont29

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

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

M	source/blender/blenkernel/intern/collection.c
M	source/blender/blenkernel/intern/library_query.c

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

diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c
index 33287d5a2f8..a3782deecad 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -683,8 +683,9 @@ static void collection_missing_parents_remove(Collection *collection)
 {
 	for (CollectionParent *parent = collection->parents.first, *parent_next; parent != NULL; parent = parent_next) {
 		parent_next = parent->next;
-
-		if (!collection_find_child(parent->collection, collection)) {
+		if ((parent->collection == NULL) ||
+		    !collection_find_child(parent->collection, collection))
+		{
 			BLI_freelinkN(&collection->parents, parent);
 		}
 	}
diff --git a/source/blender/blenkernel/intern/library_query.c b/source/blender/blenkernel/intern/library_query.c
index 9428e1508a4..ab50cf8b0a8 100644
--- a/source/blender/blenkernel/intern/library_query.c
+++ b/source/blender/blenkernel/intern/library_query.c
@@ -747,6 +747,9 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
 				for (CollectionChild *child = collection->children.first; child; child = child->next) {
 					CALLBACK_INVOKE(child->collection, IDWALK_CB_USER);
 				}
+				for (CollectionParent *parent = collection->parents.first; parent; parent = parent->next) {
+					CALLBACK_INVOKE(parent->collection, IDWALK_CB_NOP);
+				}
 				break;
 			}



More information about the Bf-blender-cvs mailing list