diff options
author | Stephen Kennedy | 2008-08-13 19:16:04 +0000 |
---|---|---|
committer | Stephen Kennedy | 2008-08-13 19:16:04 +0000 |
commit | 6b638f0e58d45096ca77cfafec5e59b14e706d1a (patch) | |
tree | a3880abb51ed70d75b140ebcc6744d5985f83478 | |
parent | 17c1dba992b5c76787ed6b52e8f7753ce3bbaef7 (diff) | |
download | scummvm-rg350-6b638f0e58d45096ca77cfafec5e59b14e706d1a.tar.gz scummvm-rg350-6b638f0e58d45096ca77cfafec5e59b14e706d1a.tar.bz2 scummvm-rg350-6b638f0e58d45096ca77cfafec5e59b14e706d1a.zip |
Bug fix: Widget removal from dialog now handled properly
svn-id: r33841
-rw-r--r-- | gui/dialog.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/gui/dialog.cpp b/gui/dialog.cpp index ef396301be..6fce837aa0 100644 --- a/gui/dialog.cpp +++ b/gui/dialog.cpp @@ -80,12 +80,12 @@ int Dialog::runModal() { } void Dialog::open() { - Widget *w = _firstWidget; _result = 0; _visible = true; g_gui.openDialog(this); + Widget *w = _firstWidget; // Search for the first objects that wantsFocus() (if any) and give it the focus while (w && !w->wantsFocus()) { w = w->_next; @@ -331,14 +331,18 @@ void Dialog::removeWidget(Widget *del) { Widget *w = _firstWidget; if (del == _firstWidget) { - _firstWidget = _firstWidget->_next; + Widget *del_next = del->_next; + del->_next = 0; + _firstWidget = del_next; return; } w = _firstWidget; while (w) { if (w->_next == del) { - w->_next = w->_next->_next; + Widget *del_next = del->_next; + del->_next = 0; + w->_next = del_next; return; } w = w->_next; |