From 78561ca94de80f00c6a65c77944ea8e3acd6e7cb Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Thu, 6 Apr 2017 21:52:55 +0100 Subject: GUI: Fix access to deleted widget after rebuilding a dialog The issue was with the focus or mouse widget as it may not be a direct child of the dialog (it may for example be a child of the tab widget in the options dialog) and removing a widget was not resetting the mouse of focus widget if that widget was not a direct child. --- gui/dialog.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gui') diff --git a/gui/dialog.cpp b/gui/dialog.cpp index 523227a237..d0e5755a59 100644 --- a/gui/dialog.cpp +++ b/gui/dialog.cpp @@ -361,11 +361,11 @@ Widget *Dialog::findWidget(const char *name) { } void Dialog::removeWidget(Widget *del) { - if (del == _mouseWidget) + if (del == _mouseWidget || del->containsWidget(_mouseWidget)) _mouseWidget = NULL; - if (del == _focusedWidget) + if (del == _focusedWidget || del->containsWidget(_focusedWidget)) _focusedWidget = NULL; - if (del == _dragWidget) + if (del == _dragWidget || del->containsWidget(_dragWidget)) _dragWidget = NULL; GuiObject::removeWidget(del); -- cgit v1.2.3