[Bf-blender-cvs] [6dd2e193e16] master: Fix T101405: Deleting a baked action results in an error.

Bastien Montagne noreply at git.blender.org
Wed Oct 5 16:26:43 CEST 2022


Commit: 6dd2e193e16fcae720b40d18e29c9e395b014833
Author: Bastien Montagne
Date:   Wed Oct 5 15:54:03 2022 +0200
Branches: master
https://developer.blender.org/rB6dd2e193e16fcae720b40d18e29c9e395b014833

Fix T101405: Deleting a baked action results in an error.

RNA code to create new actions did not properly remove the extra user
set by default, as done in other `new` callbacks of other ID types.

NOTE: Mask ID had the same issue, also fixed in this commit.

NOTE: At some point this needs to be properly fixed, default super-low
level ID creation code should simply not add a 'default' user, this is
extremely bad design and forces higher-level code to do all kind of
extra work to get rid of it half of the time, in very unclear and
confusing ways and places.

===================================================================

M	source/blender/makesrna/intern/rna_main_api.c

===================================================================

diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index 1f21fa3fab9..35678f2f1dd 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -629,6 +629,7 @@ static bAction *rna_Main_actions_new(Main *bmain, const char *name)
 
   bAction *act = BKE_action_add(bmain, safe_name);
   id_fake_user_clear(&act->id);
+  id_us_min(&act->id);
 
   WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
 
@@ -701,6 +702,7 @@ static Mask *rna_Main_mask_new(Main *bmain, const char *name)
   rna_idname_validate(name, safe_name);
 
   Mask *mask = BKE_mask_new(bmain, safe_name);
+  id_us_min(&mask->id);
 
   WM_main_add_notifier(NC_ID | NA_ADDED, NULL);



More information about the Bf-blender-cvs mailing list