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

to replace an existing one.
This commit is contained in:
Brecht Van Lommel 2011-11-05 10:48:43 +00:00
parent 010cd66747
commit 45b8a61bf3

@ -183,7 +183,10 @@ static int gp_data_add_exec (bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
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");
}
@ -231,7 +234,7 @@ static int gp_data_unlink_exec (bContext *C, wmOperator *op)
/* just unlink datablock now, decreasing its user count */
bGPdata *gpd= (*gpd_ptr);
gpd->id.us--;
id_us_min(&gpd->id);
*gpd_ptr= NULL;
}