Fix T89765: boolean modifier collection refcount issue

The 'collection' property is flagged PROP_ID_REFCOUNT, so the
modifiers foreachIDLink functions should walk with IDWALK_CB_USER
(instead of IDWALK_CB_NOP).

Otherwise the modifier wont be included as a user for the collection
(e.g. on file read); removing the collection from the modifier will
decrement usercount though (which in worst case scenario makes the
collection orphan and will result in data loss)

Maniphest Tasks: T89765

Differential Revision: https://developer.blender.org/D11877
This commit is contained in:
Philipp Oeser 2021-07-10 16:15:59 +02:00 committed by Jeroen Bakker
parent 563fdaaa39
commit 2d32bf14e4
Notes: blender-bot 2023-02-14 07:31:32 +01:00
Referenced by issue #88449, Blender LTS: Maintenance Task 2.93
Referenced by issue #89765, Collection user counts are set to `1` on file load. Boolean modifier orphans Collections.
1 changed files with 1 additions and 1 deletions

View File

@ -109,7 +109,7 @@ static void foreachIDLink(ModifierData *md, Object *ob, IDWalkFunc walk, void *u
{
BooleanModifierData *bmd = (BooleanModifierData *)md;
walk(userData, ob, (ID **)&bmd->collection, IDWALK_CB_NOP);
walk(userData, ob, (ID **)&bmd->collection, IDWALK_CB_USER);
walk(userData, ob, (ID **)&bmd->object, IDWALK_CB_NOP);
}