[Bf-blender-cvs] [fd43b70] master: Fix memory leak switching sculpt mode + dyntopo

Campbell Barton noreply at git.blender.org
Thu Jul 7 07:48:08 CEST 2016


Commit: fd43b7077fafb47a96d2dbd8c0b3f94513a3b5b5
Author: Campbell Barton
Date:   Thu Jul 7 15:48:25 2016 +1000
Branches: master
https://developer.blender.org/rBfd43b7077fafb47a96d2dbd8c0b3f94513a3b5b5

Fix memory leak switching sculpt mode + dyntopo

Auto-enabling dyntopo w/ mode switching leaked memory when undo was used.

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

M	source/blender/editors/sculpt_paint/sculpt.c

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

diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 0931456..cc7531b 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -5462,7 +5462,10 @@ static int sculpt_mode_toggle_exec(bContext *C, wmOperator *op)
 			}
 
 			if (message_unsupported == NULL) {
+				/* undo push is needed to prevent memory leak */
+				sculpt_undo_push_begin("Dynamic topology enable");
 				sculpt_dynamic_topology_enable(C);
+				sculpt_undo_push_node(ob, NULL, SCULPT_UNDO_DYNTOPO_BEGIN);
 			}
 			else {
 				BKE_reportf(op->reports, RPT_WARNING,




More information about the Bf-blender-cvs mailing list