Fix T56717: crash removing/adding objects.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Mon, 10 Sep 2018 14:06:58 +0000 (16:06 +0200)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Mon, 10 Sep 2018 14:09:52 +0000 (16:09 +0200)
Object bases hash always needs to be freed on library remapping.

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

index 1f6ab06fb4924d8f616aaff12a91bd77f7512a1d..75f721b79e6cf8909eb46e8a6f2a7435ef5f9ed7 100644 (file)
@@ -673,7 +673,7 @@ void BKE_collections_child_remove_nulls(Main *bmain, Collection *old_collection)
        }
 
        if (changed) {
-               BKE_main_collection_sync(bmain);
+               BKE_main_collection_sync_remap(bmain);
        }
 }
 
index fc2e4cd4723eedaaf8ca841c999f0698adfd9026..6ebcf399b3faedd5dbe442df731f523cb2eeb199 100644 (file)
@@ -299,9 +299,8 @@ static void libblock_remap_data_postprocess_object_update(Main *bmain, Object *o
                  * to remove the NULL children from collections not used in any scene. */
                BKE_collections_object_remove_nulls(bmain);
        }
-       else {
-               BKE_main_collection_sync_remap(bmain);
-       }
+
+       BKE_main_collection_sync_remap(bmain);
 
        if (old_ob->type == OB_MBALL) {
                for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
@@ -320,9 +319,8 @@ static void libblock_remap_data_postprocess_collection_update(Main *bmain, Colle
                  * because of pointer replacement. */
                BKE_collections_child_remove_nulls(bmain, old_collection);
        }
-       else {
-               BKE_main_collection_sync_remap(bmain);
-       }
+
+       BKE_main_collection_sync_remap(bmain);
 }
 
 static void libblock_remap_data_postprocess_obdata_relink(Main *bmain, Object *ob, ID *new_id)