diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-11-10 18:22:41 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-11-10 18:22:41 +0300 |
commit | fcf6f78d194289c3cc7a5a7a18efcbd24571c822 (patch) | |
tree | be4f7b103ee176d80d2b9919d73d2a36906f4904 /source | |
parent | 78ebb59604b5fe13c2fdd9393c8575ca56feb672 (diff) |
Fix (unreported) crash when deleting collection in freshly duplicated scene.
From startup .blend, add a 'full copy' new scene, and delete its
Collection 1.001 collection. That would make blender crash, once again
due to NULL collection pointer in some ChildrenCollection struct...
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/library_remap.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/library_remap.c b/source/blender/blenkernel/intern/library_remap.c index 8a011b55cf3..404028f336e 100644 --- a/source/blender/blenkernel/intern/library_remap.c +++ b/source/blender/blenkernel/intern/library_remap.c @@ -323,10 +323,14 @@ static void libblock_remap_data_postprocess_object_update(Main *bmain, Object *o /* Can be called with both old_collection and new_collection being NULL, * this means we have to check whole Main database then. */ static void libblock_remap_data_postprocess_collection_update( - Main *bmain, Collection *old_collection, Collection *new_collection) + Main *bmain, Collection *UNUSED(old_collection), Collection *new_collection) { if (new_collection == NULL) { - BKE_collections_child_remove_nulls(bmain, old_collection); + /* XXX Complex cases can lead to NULL pointers in other collections than old_collection, + * and BKE_main_collection_sync_remap() does not tolerate any of those, so for now always check whole + * existing collections for NULL pointers. + * I'd consider optimizing that whole collection remapping process a TODO for later. */ + BKE_collections_child_remove_nulls(bmain, NULL /*old_collection*/); } BKE_main_collection_sync_remap(bmain); |