[Bf-blender-cvs] [070391998f9] greasepencil-object: GPencil: Fix memory leak sorting palettes

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


Commit: 070391998f9371a2d53c8a429acfe53ad9709442
Author: Antonio Vazquez
Date:   Mon Nov 18 16:23:11 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB070391998f9371a2d53c8a429acfe53ad9709442

GPencil: Fix memory leak sorting 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 7da81ecf2ba..f57bf9bfcd6 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -444,7 +444,11 @@ static int palette_sort_exec(bContext *C, wmOperator *op)
     BKE_palette_sort_hsv(color_array, totcol);
 
     /* Clear old color swatches. */
-    BLI_listbase_clear(&palette->colors);
+    PaletteColor *color_next = NULL;
+    for (PaletteColor *color = palette->colors.first; color; color = color_next) {
+      color_next = color->next;
+      BKE_palette_color_remove(palette, color);
+    }
 
     /* Recreate swatches sorted. */
     for (int i = 0; i < totcol; i++) {



More information about the Bf-blender-cvs mailing list