[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18536] branches/blender2.5/blender/source /blender/editors/sculpt/sculpt.c: Fix sculpt memory leaks

Nicholas Bishop nicholasbishop at gmail.com
Fri Jan 16 04:24:30 CET 2009


Revision: 18536
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18536
Author:   nicholasbishop
Date:     2009-01-16 04:24:12 +0100 (Fri, 16 Jan 2009)

Log Message:
-----------
Fix sculpt memory leaks

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/sculpt/sculpt.c

Modified: branches/blender2.5/blender/source/blender/editors/sculpt/sculpt.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/sculpt/sculpt.c	2009-01-16 01:56:11 UTC (rev 18535)
+++ branches/blender2.5/blender/source/blender/editors/sculpt/sculpt.c	2009-01-16 03:24:12 UTC (rev 18536)
@@ -1588,6 +1588,7 @@
 		MEM_freeN(cache->mesh_store);
 	if(cache->orig_norms)
 		MEM_freeN(cache->orig_norms);
+	MEM_freeN(cache);
 }
 
 /* Initialize the stroke cache invariants from operator properties */
@@ -1745,6 +1746,13 @@
 	}
 }
 
+static void sculpt_post_stroke_free(SculptSession *ss)
+{
+	//calc_damaged_verts(sd->session, &a);
+	BLI_freelistN(&ss->damaged_rects);
+	BLI_freelistN(&ss->damaged_verts);
+}
+
 static int sculpt_brush_stroke_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
 	PointerRNA itemptr;
@@ -1766,9 +1774,9 @@
 
 	sculpt_restore_mesh(sd);
 	do_symmetrical_brush_actions(&CTX_data_scene(C)->sculptdata, sd->session->cache);
-	//calc_damaged_verts(sd->session, &a);
-	BLI_freelistN(&sd->session->damaged_verts);
 
+	sculpt_post_stroke_free(sd->session);
+
 	DAG_object_flush_update(CTX_data_scene(C), ob, OB_RECALC_DATA);
 	ED_region_tag_redraw(ar);
 
@@ -1799,7 +1807,8 @@
 
 		sculpt_restore_mesh(sd);
 		do_symmetrical_brush_actions(sd, sd->session->cache);
-		BLI_freelistN(&sd->session->damaged_verts);
+
+		sculpt_post_stroke_free(sd->session);
 	}
 	RNA_END;
 





More information about the Bf-blender-cvs mailing list