[Bf-blender-cvs] [af594b7] strand_editmode: Fix meamleak from unfreed edit data when exiting in hair edit mode.

Lukas Tönne noreply at git.blender.org
Wed Apr 20 09:30:05 CEST 2016


Commit: af594b7b858a43c000272beffb2211a6cf6b0c00
Author: Lukas Tönne
Date:   Tue Apr 19 14:19:54 2016 +0200
Branches: strand_editmode
https://developer.blender.org/rBaf594b7b858a43c000272beffb2211a6cf6b0c00

Fix meamleak from unfreed edit data when exiting in hair edit mode.

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

M	source/blender/editors/util/ed_util.c

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

diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c
index 1f4ce92..4b062bc 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -52,6 +52,7 @@
 #include "BLT_translation.h"
 
 #include "BKE_context.h"
+#include "BKE_editstrands.h"
 #include "BKE_global.h"
 #include "BKE_main.h"
 #include "BKE_multires.h"
@@ -122,6 +123,7 @@ void ED_editors_exit(bContext *C)
 {
 	Main *bmain = CTX_data_main(C);
 	Scene *sce;
+	Object *ob;
 
 	if (!bmain)
 		return;
@@ -132,7 +134,7 @@ void ED_editors_exit(bContext *C)
 	
 	for (sce = bmain->scene.first; sce; sce = sce->id.next) {
 		if (sce->obedit) {
-			Object *ob = sce->obedit;
+			ob = sce->obedit;
 		
 			if (ob) {
 				if (ob->type == OB_MESH) {
@@ -149,6 +151,17 @@ void ED_editors_exit(bContext *C)
 			}
 		}
 	}
+	
+	for (ob = bmain->object.first; ob; ob = ob->id.next) {
+		if (ob->type == OB_MESH) {
+			Mesh *me = ob->data;
+			if (me->edit_strands) {
+				BKE_editstrands_free(me->edit_strands);
+				MEM_freeN(me->edit_strands);
+				me->edit_strands = NULL;
+			}
+		}
+	}
 
 	/* global in meshtools... */
 	ED_mesh_mirror_spatial_table(NULL, NULL, NULL, NULL, 'e');




More information about the Bf-blender-cvs mailing list