[Bf-blender-cvs] [913693839cb] greasepencil-object: Fix memory leak when paste

Antonio Vazquez noreply at git.blender.org
Sat Apr 28 16:50:07 CEST 2018


Commit: 913693839cb49b95e98c5a5c6983c2e1db96c3a6
Author: Antonio Vazquez
Date:   Sat Apr 28 16:49:51 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB913693839cb49b95e98c5a5c6983c2e1db96c3a6

Fix memory leak  when paste

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

M	source/blender/editors/gpencil/gpencil_edit.c

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

diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 3db65bc95a3..d5be21afc70 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -701,11 +701,11 @@ void ED_gpencil_strokes_copybuf_free(void)
 {
 	bGPDstroke *gps, *gpsn;
 	
-	/* Free the palettes buffer
-	 * NOTE: This is done before the strokes so that the name ptrs (keys) are still safe
+	/* Free the colors buffer
+	 * NOTE: This is done before the strokes so that the ptrs are still safe
 	 */
 	if (gp_strokes_copypastebuf_colors) {
-		BLI_ghash_free(gp_strokes_copypastebuf_colors, NULL, MEM_freeN);
+		BLI_ghash_free(gp_strokes_copypastebuf_colors, NULL, NULL);
 		gp_strokes_copypastebuf_colors = NULL;
 	}
 	
@@ -994,7 +994,10 @@ static int gp_strokes_paste_exec(bContext *C, wmOperator *op)
 			}
 		}
 	}
-	
+
+	/* free temp data */
+	BLI_ghash_free(new_colors, NULL, NULL);
+
 	/* updates */
 	BKE_gpencil_batch_cache_dirty(gpd);
 	WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);



More information about the Bf-blender-cvs mailing list