From 761caac0b24062f76d875c72722c1d07b64fb4ad Mon Sep 17 00:00:00 2001 From: Marcelo Fernandez Date: Thu, 14 Feb 2019 22:16:56 -0300 Subject: Fix possible crash with an invalid last_mouse_focus pointer --- scene/main/viewport.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index cad29f13bf..f7df29fd19 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -2496,6 +2496,9 @@ void Viewport::_gui_remove_control(Control *p_control) { gui.mouse_focus = NULL; gui.mouse_focus_mask = 0; } + if (gui.last_mouse_focus == p_control) { + gui.last_mouse_focus = NULL; + } if (gui.key_focus == p_control) gui.key_focus = NULL; if (gui.mouse_over == p_control) -- cgit v1.2.3