diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-11-09 21:47:10 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-11-09 23:00:53 +0300 |
commit | 865796375bcfa6be4288cca4243dddcb4092f70b (patch) | |
tree | 5264d4b9b0f9d392b6e1b942e0f6fd802de1fff4 /source/blender/editors/render/render_shading.c | |
parent | cf959a879eb5ffbdfa573c5f3a00965e69d7a976 (diff) |
Cleanup: avoid incrementing/decrementing id->us outside of BKE_library.
We have callbacks for that, they also do some checks and help ensure things are done
correctly. Only place where this is assumed not true is blenloader (since here we
may affect refcount of library IDs as well...).
Diffstat (limited to 'source/blender/editors/render/render_shading.c')
-rw-r--r-- | source/blender/editors/render/render_shading.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 2e07e19e366..b540b9df16f 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -481,7 +481,7 @@ static int new_material_exec(bContext *C, wmOperator *UNUSED(op)) if (prop) { /* when creating new ID blocks, use is already 1, but RNA * pointer use also increases user, so this compensates it */ - ma->id.us--; + id_us_min(&ma->id); RNA_id_pointer_create(&ma->id, &idptr); RNA_property_pointer_set(&ptr, prop, idptr); @@ -530,7 +530,7 @@ static int new_texture_exec(bContext *C, wmOperator *UNUSED(op)) if (prop) { /* when creating new ID blocks, use is already 1, but RNA * pointer se also increases user, so this compensates it */ - tex->id.us--; + id_us_min(&tex->id); if (ptr.id.data && GS(((ID *)ptr.id.data)->name) == ID_MA && RNA_property_pointer_get(&ptr, prop).id.data == NULL) @@ -593,7 +593,7 @@ static int new_world_exec(bContext *C, wmOperator *UNUSED(op)) if (prop) { /* when creating new ID blocks, use is already 1, but RNA * pointer se also increases user, so this compensates it */ - wo->id.us--; + id_us_min(&wo->id); RNA_id_pointer_create(&wo->id, &idptr); RNA_property_pointer_set(&ptr, prop, idptr); @@ -1039,7 +1039,7 @@ static int freestyle_linestyle_new_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } if (lineset->linestyle) { - lineset->linestyle->id.us--; + id_us_min(&lineset->linestyle->id); lineset->linestyle = BKE_linestyle_copy(bmain, lineset->linestyle); } else { @@ -1826,7 +1826,7 @@ static void paste_mtex_copybuf(ID *id) *mtex = MEM_mallocN(sizeof(MTex), "mtex copy"); } else if ((*mtex)->tex) { - (*mtex)->tex->id.us--; + id_us_min(&(*mtex)->tex->id); } memcpy(*mtex, &mtexcopybuf, sizeof(MTex)); |