[Bf-blender-cvs] [2bbdf586d5f] master: Gpencil: Fix unreported memory leak duplicating Brush

Antonio Vazquez noreply at git.blender.org
Tue Nov 26 19:05:10 CET 2019


Commit: 2bbdf586d5ff1682c7a744d1282dfd41aba78390
Author: Antonio Vazquez
Date:   Tue Nov 26 19:04:48 2019 +0100
Branches: master
https://developer.blender.org/rB2bbdf586d5ff1682c7a744d1282dfd41aba78390

Gpencil: Fix unreported memory leak duplicating Brush

When the brush is duplicated, the grease pencil settings doesn't need to be recreated.

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

M	source/blender/editors/sculpt_paint/paint_ops.c

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

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;
 }



More information about the Bf-blender-cvs mailing list