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/blenkernel/intern/brush.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/blenkernel/intern/brush.c')
-rw-r--r-- | source/blender/blenkernel/intern/brush.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 95b65f52bd0..201750df5a7 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -195,7 +195,7 @@ Brush *BKE_brush_copy(Brush *brush) /* enable fake user by default */ if (!(brushn->id.flag & LIB_FAKEUSER)) { brushn->id.flag |= LIB_FAKEUSER; - brushn->id.us++; + id_us_plus(&brushn->id); } if (brush->id.lib) { @@ -282,7 +282,7 @@ void BKE_brush_make_local(Brush *brush) /* enable fake user by default */ if (!(brush->id.flag & LIB_FAKEUSER)) { brush->id.flag |= LIB_FAKEUSER; - brush->id.us++; + id_us_plus(&brush->id); } } else if (is_local && is_lib) { @@ -505,7 +505,7 @@ int BKE_brush_texture_set_nr(Brush *brush, int nr) if (idtest == NULL) { /* new tex */ if (id) idtest = (ID *)BKE_texture_copy((Tex *)id); else idtest = (ID *)BKE_texture_add(G.main, "Tex"); - idtest->us--; + id_us_min(idtest); } if (idtest != id) { BKE_brush_texture_delete(brush); @@ -522,7 +522,7 @@ int BKE_brush_texture_set_nr(Brush *brush, int nr) int BKE_brush_texture_delete(Brush *brush) { if (brush->mtex.tex) - brush->mtex.tex->id.us--; + id_us_min(&brush->mtex.tex->id); return 1; } @@ -548,7 +548,7 @@ int BKE_brush_clone_image_set_nr(Brush *brush, int nr) int BKE_brush_clone_image_delete(Brush *brush) { if (brush && brush->clone.image) { - brush->clone.image->id.us--; + id_us_min(&brush->clone.image->id); brush->clone.image = NULL; return 1; } |