From 0451934538561594229e18b4ccb89a8e85b3a405 Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Wed, 28 Jan 2015 11:09:19 +0100 Subject: [PATCH] Properly decrease users of images when deleting a paint slot. --- source/blender/editors/sculpt_paint/paint_image_proj.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 3e675012d05..fd1ca1b0083 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -5323,8 +5323,13 @@ static int texture_paint_delete_texture_paint_slot_exec(bContext *C, wmOperator slot = ma->texpaintslot + ma->paint_active_slot; - if (ma->mtex[slot->index]->tex) + if (ma->mtex[slot->index]->tex) { id_us_min(&ma->mtex[slot->index]->tex->id); + + if (ma->mtex[slot->index]->tex->ima) { + id_us_min(&ma->mtex[slot->index]->tex->ima->id); + } + } MEM_freeN(ma->mtex[slot->index]); ma->mtex[slot->index] = NULL;