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
commit009a748ab33a77613aad7d269a79eb74a3be5080 (patch)
tree7f8375ad9c71f349b2371ab9daf56555c928ce73
parent15e89b32b9276d056f4d7f5c2b9683e80286df52 (diff)
downloadopenttd-009a748ab33a77613aad7d269a79eb74a3be5080.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;