Fix T100040: Crash when transform applied on multi-user image

Affected by rB8621fdb10dc4
Crash if single-user data is created when we apply transform
on multi-user image data. Crash occurs because creation of new copy
was not handled in `single_obdata_users` for empty objects (image for example)

Reviewed By: dfelinto, mont29

Maniphest Tasks: T100040

Differential Revision: https://developer.blender.org/D15587
This commit is contained in:
Pratik Borhade 2022-08-01 17:07:56 +02:00 committed by Dalai Felinto
parent 4d8018948d
commit 3e8bd1f6e4
Notes: blender-bot 2023-02-14 05:37:19 +01:00
Referenced by issue #100040, Crash with rescaling reference image and apply scale
Referenced by issue #98661, 3.2: Potential candidates for corrective releases
1 changed files with 5 additions and 0 deletions

View File

@ -1830,6 +1830,11 @@ static void single_obdata_users(
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
switch (ob->type) {
case OB_EMPTY:
ob->data = ID_NEW_SET(
ob->data,
BKE_id_copy_ex(bmain, ob->data, NULL, LIB_ID_COPY_DEFAULT | LIB_ID_COPY_ACTIONS));
break;
case OB_LAMP:
ob->data = la = ID_NEW_SET(
ob->data,