Commit D31 : Check if the user count needs to be decreased after adding a new BI image texture.

Fixes this problem:

*Go to the Blender (BI) textures tab and open an existing image.
*Hit on the plus sign next to datablock to create a new image.
*Complete the creation process and switch back to the first (loaded) image.
-> The image user count raises... will raise as often as you hit the plus sign
This commit is contained in:
Thomas Beck
2013-11-24 13:54:47 +01:00
parent 1fe114a876
commit 1e096852bf

View File

@@ -1792,7 +1792,9 @@ static int image_new_exec(bContext *C, wmOperator *op)
else {
Tex *tex = CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
if (tex && tex->type == TEX_IMAGE) {
tex->ima = ima;
if (tex->ima)
tex->ima->id.us--; /* Decrease the previous image users count by 1 */
tex->ima = ima; /* Assign the new image */
ED_area_tag_redraw(CTX_wm_area(C));
}
}