aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorThierry Crozat2017-04-06 21:52:55 +0100
committerThierry Crozat2017-04-06 21:55:28 +0100
commit78561ca94de80f00c6a65c77944ea8e3acd6e7cb (patch)
tree9feabe8a9bb67160b758435c5d3ffa654809e056 /gui
parent91125bcbcd3cf9c0de9818f341a55f0e7f7b595c (diff)
downloadscummvm-rg350-78561ca94de80f00c6a65c77944ea8e3acd6e7cb.tar.gz
scummvm-rg350-78561ca94de80f00c6a65c77944ea8e3acd6e7cb.tar.bz2
scummvm-rg350-78561ca94de80f00c6a65c77944ea8e3acd6e7cb.zip
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.
Diffstat (limited to 'gui')
-rw-r--r--gui/dialog.cpp6
1 files changed, 3 insertions, 3 deletions
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);