summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-05-15 11:17:56 +0000
committerrubidium <rubidium@openttd.org>2008-05-15 11:17:56 +0000
commitc709b8a711039a12c4e105e9ec9c768f20cbf4a8 (patch)
tree7f8375ad9c71f349b2371ab9daf56555c928ce73
parent35c14f45bedea917cd85c4c0033c6f46e2ac712b (diff)
downloadopenttd-c709b8a711039a12c4e105e9ec9c768f20cbf4a8.tar.xz
(svn r13099) -Fix [FS#2014]: when a window had children only one of them would be closed (on a parent closure) instead of all children.
-rw-r--r--src/window.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/window.cpp b/src/window.cpp
index 09320a003..f759784a2 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -626,8 +626,12 @@ Window::~Window()
memmove(wz, wz + 1, (byte*)_last_z_window - (byte*)wz);
_last_z_window--;
- /* Delete any children a window might have in a head-recursive manner */
- delete FindChildWindow(this);
+ /* Delete all children a window might have in a head-recursive manner */
+ Window *child = FindChildWindow(this);
+ while (child != NULL) {
+ delete child;
+ child = FindChildWindow(this);
+ }
WindowEvent e;
e.event = WE_DESTROY;