summaryrefslogtreecommitdiff
path: root/src/window.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-09-24 16:40:06 +0000
committersmatz <smatz@openttd.org>2008-09-24 16:40:06 +0000
commit6987e6015af482de4bfa2a9233a6377d2fb1457a (patch)
tree4bdc7914fbb86480437af0957e290777e16788c6 /src/window.cpp
parent7a527807d908cfd667c8d32f89435f33f2d231a6 (diff)
downloadopenttd-6987e6015af482de4bfa2a9233a6377d2fb1457a.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.cpp19
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);