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.
This commit is contained in:
Thierry Crozat 2017-04-06 21:52:55 +01:00
parent 91125bcbcd
commit 78561ca94d

View File

@ -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);