Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2022-01-04 12:03:31 +0300
committerBastien Montagne <bastien@blender.org>2022-01-04 12:03:31 +0300
commitb2867d436585bf7ff92f1d7e9a0de9bb5ede006b (patch)
tree215aa622df6045c959434c89608b95d956742c14
parenta2a02e39941735a4a5744c133302486cb005b8a0 (diff)
Fix T94599: Assert on usercount when deleting image created via operator.
`IMAGE_OT_new` operator would not properly clear the by-default one user generated by 'new id' code, in case it could not tie the image to anything.
-rw-r--r--source/blender/editors/space_image/image_ops.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index b72fe40d510..23d07c9b45b 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -2595,6 +2595,11 @@ static int image_new_exec(bContext *C, wmOperator *op)
else if (sima) {
ED_space_image_set(bmain, sima, ima, false);
}
+ else {
+ /* #BKE_image_add_generated creates one user by default, remove it if image is not linked to
+ * anything. ref. T94599. */
+ id_us_min(&ima->id);
+ }
BKE_image_signal(bmain, ima, (sima) ? &sima->iuser : NULL, IMA_SIGNAL_USER_NEW_IMAGE);