diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-11-09 22:06:46 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-11-09 23:00:53 +0300 |
commit | f761ae8f116909f1d5c92398f8a4812a5fad8ca4 (patch) | |
tree | d3b85fb2240a81559cc01bf7ec44453164a961b0 /source | |
parent | 865796375bcfa6be4288cca4243dddcb4092f70b (diff) |
Rework a bit id_us_min, and make it assert on usercount error.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/library.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 90cd950a78d..fe5ddb5fd93 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -184,12 +184,11 @@ void id_us_plus(ID *id) void id_us_min(ID *id) { if (id) { - if (id->us < 2 && (id->flag & LIB_FAKEUSER)) { - printf("ID user decrement error: %s\n", id->name); - id->us = 1; - } - else if (id->us <= 0) { - printf("ID user decrement error: %s\n", id->name); + const int limit = (id->flag & LIB_FAKEUSER) ? 1 : 0; + if (id->us <= limit) { + printf("ID user decrement error: %s (from '%s')\n", id->name, id->lib ? id->lib->filepath : "[Main]"); + BLI_assert(0); + id->us = limit; } else { id->us--; |