From 6b638f0e58d45096ca77cfafec5e59b14e706d1a Mon Sep 17 00:00:00 2001 From: Stephen Kennedy Date: Wed, 13 Aug 2008 19:16:04 +0000 Subject: Bug fix: Widget removal from dialog now handled properly svn-id: r33841 --- gui/dialog.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'gui') 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; -- cgit v1.2.3