diff options
author | smatz <smatz@openttd.org> | 2008-09-24 16:40:06 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2008-09-24 16:40:06 +0000 |
commit | a000de84187c2b2eff9fae2cf89163bf073a498d (patch) | |
tree | 4bdc7914fbb86480437af0957e290777e16788c6 /src/window.cpp | |
parent | 8b84fea7e1279ea98ef6e9ea2fba0a4d4fb9a501 (diff) | |
download | openttd-a000de84187c2b2eff9fae2cf89163bf073a498d.tar.xz |
(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, ...
Diffstat (limited to 'src/window.cpp')
-rw-r--r-- | src/window.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/window.cpp b/src/window.cpp index 2a46da55b..3d7bdf5c0 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -392,6 +392,18 @@ Window **FindWindowZPosition(const Window *w) } /** + * 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. */ Window::~Window() @@ -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); |