diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index c915bc9ea37c3a54b81c5f9195de0c1e14092c06..d481be94bcc8d1e64d82f62edaa6d1d3d2863b27 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -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; }