Fix double free for drag preview control in viewport

(cherry picked from commit 56c2463f8c)
This commit is contained in:
Geequlim 2018-05-08 13:52:38 +08:00 committed by Hein-Pieter van Braam
parent c8ce9c0080
commit 0c030d6e08

View file

@ -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_control->set_position(gui.last_mouse_pos);
p_base->get_root_parent_control()->add_child(p_control); //add as child of viewport p_base->get_root_parent_control()->add_child(p_control); //add as child of viewport
p_control->raise(); p_control->raise();
if (gui.drag_preview) {
memdelete(gui.drag_preview);
}
gui.drag_preview = p_control; gui.drag_preview = p_control;
} }