(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open

-Fix: close any dropdown and child windows in the Order and Timetable windows when selected order is deselected, deleted, ...
This commit is contained in:
smatz
2008-09-24 16:40:06 +00:00
parent 7a527807d9
commit 6987e6015a
11 changed files with 209 additions and 78 deletions

View File

@@ -391,6 +391,18 @@ Window **FindWindowZPosition(const Window *w)
return NULL;
}
/**
* Delete all children a window might have in a head-recursive manner
*/
void Window::DeleteChildWindows() const
{
Window *child = FindChildWindow(this);
while (child != NULL) {
delete child;
child = FindChildWindow(this);
}
}
/**
* Remove window and all its child windows from the window stack.
*/
@@ -414,12 +426,7 @@ Window::~Window()
memmove(wz, wz + 1, (byte*)_last_z_window - (byte*)wz);
_last_z_window--;
/* Delete all children a window might have in a head-recursive manner */
Window *child = FindChildWindow(this);
while (child != NULL) {
delete child;
child = FindChildWindow(this);
}
this->DeleteChildWindows();
if (this->viewport != NULL) DeleteWindowViewport(this);