[Bf-blender-cvs] [c2791777bd8] blender2.8: Fix stupid multiple-call of same function in Collections remapping code.

Bastien Montagne noreply at git.blender.org
Mon Oct 29 11:43:37 CET 2018


Commit: c2791777bd8bd4a0375ada74b84c2142c6ce73cc
Author: Bastien Montagne
Date:   Mon Oct 29 10:49:46 2018 +0100
Branches: blender2.8
https://developer.blender.org/rBc2791777bd8bd4a0375ada74b84c2142c6ce73cc

Fix stupid multiple-call of same function in Collections remapping code.

Related to T57372: Second full scene copy crashes on deletion (fixes
deleting second copy, but now it crashes on deleting the first copy...).

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

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

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

diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c
index 51e508d7744..e6546d4454d 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -654,11 +654,10 @@ void BKE_collections_object_remove_nulls(Main *bmain)
  * Remove all NULL children from parent objects of changed old_collection.
  * This is used for library remapping, where these pointers have been set to NULL.
  * Otherwise this should never happen.
+ * Note: caller must ensure BKE_main_collection_sync_remap() is called afterwards!
  */
 void BKE_collections_child_remove_nulls(Main *bmain, Collection *old_collection)
 {
-	bool changed = false;
-
 	for (CollectionParent *cparent = old_collection->parents.first, *cnext; cparent; cparent = cnext) {
 		Collection *parent = cparent->collection;
 		cnext = cparent->next;
@@ -668,19 +667,13 @@ void BKE_collections_child_remove_nulls(Main *bmain, Collection *old_collection)
 
 			if (child->collection == NULL) {
 				BLI_freelinkN(&parent->children, child);
-				changed = true;
 			}
 		}
 
 		if (!collection_find_child(parent, old_collection)) {
 			BLI_freelinkN(&old_collection->parents, cparent);
-			changed = true;
 		}
 	}
-
-	if (changed) {
-		BKE_main_collection_sync_remap(bmain);
-	}
 }
 
 /**
diff --git a/source/blender/blenkernel/intern/library_remap.c b/source/blender/blenkernel/intern/library_remap.c
index 9e3001de572..114159debe3 100644
--- a/source/blender/blenkernel/intern/library_remap.c
+++ b/source/blender/blenkernel/intern/library_remap.c
@@ -326,9 +326,9 @@ static void libblock_remap_data_postprocess_collection_update(
         Main *bmain, Collection *old_collection, Collection *new_collection)
 {
 	if (new_collection == NULL) {
-		 /* In case we unlinked old_collection (new_collection is NULL), we need
-		  * to remove any collection children that have been set to NULL in the
-		  * because of pointer replacement. */
+		/* In case we unlinked old_collection (new_collection is NULL), we need
+		 * to remove any collection children that have been set to NULL in the
+		 * because of pointer replacement. */
 		if (old_collection != NULL) {
 			BKE_collections_child_remove_nulls(bmain, old_collection);
 		}



More information about the Bf-blender-cvs mailing list