From cec1691a91e90fafe336b708cbcd19ebd249f58d Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Fri, 27 Feb 2015 17:03:10 +1300 Subject: Code Cleanup: Clarify some comments regarding usercount management (Note for the uninitiated looking at the diffs: this is very much *not* what you're probably thinking right now, if you're looking at the line in act_new_exec()) --- source/blender/editors/space_action/action_edit.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'source/blender/editors/space_action') diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index bc9c578b558..28e10a90a87 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -109,9 +109,11 @@ static int act_new_exec(bContext *C, wmOperator *UNUSED(op)) action = add_empty_action(bmain, "Action"); } - /* when creating new ID blocks, use is already 1 (fake user), - * but RNA pointer use also increases user, so this compensates it + /* when creating new ID blocks, there is already 1 user (as for all new datablocks), + * but the RNA pointer code will assign all the proper users instead, so we compensate + * for that here */ + BLI_assert(action->id.us == 1); action->id.us--; RNA_id_pointer_create(&action->id, &idptr); @@ -134,6 +136,8 @@ void ACTION_OT_new(wmOperatorType *ot) /* api callbacks */ ot->exec = act_new_exec; + // TODO: add a new invoke() callback to catch cases where users unexpectedly delete their data + /* NOTE: this is used in the NLA too... */ //ot->poll = ED_operator_action_active; -- cgit v1.2.3