IRC bug report
authorTon Roosendaal <ton@blender.org>
Fri, 3 Dec 2010 18:39:40 +0000 (18:39 +0000)
committerTon Roosendaal <ton@blender.org>
Fri, 3 Dec 2010 18:39:40 +0000 (18:39 +0000)
Text editor, "Add new" caused zero-user block.
The claim in the code why it should be decreased is dubious.
Thanks wiseman!

source/blender/editors/space_text/text_ops.c

index 32b71dbefb77966e4ac56cdd1771afdd67fa1f8c..768a04e42c0a8cc655f837239ad737ba27f498bc 100644 (file)
@@ -162,7 +162,9 @@ static int new_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 */
-               text->id.us--;
+               /* doesnt always seem to happen... (ton) */
+               if(text->id.us>1)
+                       text->id.us--;
 
                RNA_id_pointer_create(&text->id, &idptr);
                RNA_property_pointer_set(&ptr, prop, idptr);