From fd43b7077fafb47a96d2dbd8c0b3f94513a3b5b5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 7 Jul 2016 15:48:25 +1000 Subject: Fix memory leak switching sculpt mode + dyntopo Auto-enabling dyntopo w/ mode switching leaked memory when undo was used. --- source/blender/editors/sculpt_paint/sculpt.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source/blender/editors/sculpt_paint') diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 0931456058d..cc7531b9783 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, -- cgit v1.2.3