浏览代码

Fix possible crash with an invalid last_mouse_focus pointer

Marcelo Fernandez 6 年之前
父节点
当前提交
761caac0b2
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      scene/main/viewport.cpp

+ 3 - 0
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)