diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-10-29 12:49:46 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-10-29 12:53:10 +0300 |
commit | c2791777bd8bd4a0375ada74b84c2142c6ce73cc (patch) | |
tree | 6ebe4d591ab08cc59b907e562faadad62c218c14 /source | |
parent | 262504ddd190a66f9d8353afc2c2da653a998cc4 (diff) |
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...).
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/collection.c | 9 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/library_remap.c | 6 |
2 files changed, 4 insertions, 11 deletions
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); } |