Fix T57816: Crash when deleting recently orphaned collection

We were never removing the parent collection from a collection upon removal
of the parent.

Reviewers: mont29

Differential Revision: https://developer.blender.org/D4099
This commit is contained in:
Dalai Felinto 2018-12-18 20:36:57 -02:00
parent 8cbadde1a5
commit 36184f7392
Notes: blender-bot 2023-02-14 08:47:25 +01:00
Referenced by issue #57816, Crash when deleting recently orphaned collection
2 changed files with 6 additions and 2 deletions

View File

@ -683,8 +683,9 @@ static void collection_missing_parents_remove(Collection *collection)
{
for (CollectionParent *parent = collection->parents.first, *parent_next; parent != NULL; parent = parent_next) {
parent_next = parent->next;
if (!collection_find_child(parent->collection, collection)) {
if ((parent->collection == NULL) ||
!collection_find_child(parent->collection, collection))
{
BLI_freelinkN(&collection->parents, parent);
}
}

View File

@ -747,6 +747,9 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
for (CollectionChild *child = collection->children.first; child; child = child->next) {
CALLBACK_INVOKE(child->collection, IDWALK_CB_USER);
}
for (CollectionParent *parent = collection->parents.first; parent; parent = parent->next) {
CALLBACK_INVOKE(parent->collection, IDWALK_CB_NOP);
}
break;
}