forked from mirror/OpenTTD
(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:
@@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user