From 2bbdf586d5ff1682c7a744d1282dfd41aba78390 Mon Sep 17 00:00:00 2001 From: Antonio Vazquez Date: Tue, 26 Nov 2019 19:04:48 +0100 Subject: [PATCH] Gpencil: Fix unreported memory leak duplicating Brush When the brush is duplicated, the grease pencil settings doesn't need to be recreated. --- source/blender/editors/sculpt_paint/paint_ops.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index ef907d96075..d76403521d9 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -98,7 +98,6 @@ static int brush_add_gpencil_exec(bContext *C, wmOperator *UNUSED(op)) Paint *paint = &ts->gp_paint->paint; Brush *br = BKE_paint_brush(paint); Main *bmain = CTX_data_main(C); - // ePaintMode mode = PAINT_MODE_GPENCIL; if (br) { br = BKE_brush_copy(bmain, br); @@ -106,13 +105,13 @@ static int brush_add_gpencil_exec(bContext *C, wmOperator *UNUSED(op)) else { br = BKE_brush_add(bmain, "Brush", OB_MODE_PAINT_GPENCIL); id_us_min(&br->id); /* fake user only */ + + /* Init grease pencil specific data. */ + BKE_brush_init_gpencil_settings(br); } BKE_paint_brush_set(paint, br); - /* init grease pencil specific data */ - BKE_brush_init_gpencil_settings(br); - return OPERATOR_FINISHED; }