Skip to content
Snippets Groups Projects
Commit 45b8a61b authored by Brecht Van Lommel's avatar Brecht Van Lommel
Browse files

Fix #29162: grease pencil did not decrement user count on adding new datablock

to replace an existing one.
parent 010cd667
No related branches found
Tags
No related merge requests found
...@@ -183,7 +183,10 @@ static int gp_data_add_exec (bContext *C, wmOperator *op) ...@@ -183,7 +183,10 @@ static int gp_data_add_exec (bContext *C, wmOperator *op)
return OPERATOR_CANCELLED; return OPERATOR_CANCELLED;
} }
else { else {
/* just add new datablock now */ /* decrement user count and add new datablock */
bGPdata *gpd= (*gpd_ptr);
id_us_min(&gpd->id);
*gpd_ptr= gpencil_data_addnew("GPencil"); *gpd_ptr= gpencil_data_addnew("GPencil");
} }
...@@ -231,7 +234,7 @@ static int gp_data_unlink_exec (bContext *C, wmOperator *op) ...@@ -231,7 +234,7 @@ static int gp_data_unlink_exec (bContext *C, wmOperator *op)
/* just unlink datablock now, decreasing its user count */ /* just unlink datablock now, decreasing its user count */
bGPdata *gpd= (*gpd_ptr); bGPdata *gpd= (*gpd_ptr);
gpd->id.us--; id_us_min(&gpd->id);
*gpd_ptr= NULL; *gpd_ptr= NULL;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment