summaryrefslogtreecommitdiff
path: root/src/window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/window.cpp')
-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;