[Bf-blender-cvs] [1d79231f0fd] greasepencil-object: GPencil: Fix memory leak in Join Palettes

Antonio Vazquez noreply at git.blender.org
Mon Nov 18 16:26:29 CET 2019


Commit: 1d79231f0fddadaa5328af570ff11590f2fda898
Author: Antonio Vazquez
Date:   Mon Nov 18 16:26:15 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB1d79231f0fddadaa5328af570ff11590f2fda898

GPencil: Fix memory leak in Join Palettes

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

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 f57bf9bfcd6..7a7ebbd71fd 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -576,8 +576,12 @@ static int palette_join_exec(bContext *C, wmOperator *op)
   }
 
   if (done) {
-    /* Delete old palette. */
-    BKE_palette_free(palette_join);
+    /* Clear old color swatches. */
+    PaletteColor *color_next = NULL;
+    for (PaletteColor *color = palette_join->colors.first; color; color = color_next) {
+      color_next = color->next;
+      BKE_palette_color_remove(palette_join, color);
+    }
 
     /* Notifier. */
     WM_event_add_notifier(C, NC_BRUSH | NA_EDITED, NULL);



More information about the Bf-blender-cvs mailing list