From 0c030d6e0850e8ee185ec57b7e24e3552678c9d2 Mon Sep 17 00:00:00 2001 From: Geequlim Date: Tue, 8 May 2018 13:52:38 +0800 Subject: [PATCH] Fix double free for drag preview control in viewport (cherry picked from commit 56c2463f8c1240fcf2376b7979991cbce3a3f1d3) --- scene/main/viewport.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 4f702e8ed9b..1726ad6183b 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -2162,9 +2162,7 @@ void Viewport::_gui_set_drag_preview(Control *p_base, Control *p_control) { p_control->set_position(gui.last_mouse_pos); p_base->get_root_parent_control()->add_child(p_control); //add as child of viewport p_control->raise(); - if (gui.drag_preview) { - memdelete(gui.drag_preview); - } + gui.drag_preview = p_control; }