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...).
This commit is contained in:
parent
262504ddd1
commit
c2791777bd
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue