]> git.saurik.com Git - wxWidgets.git/commitdiff
remove us from the parents children list in Destroy()
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 15 Sep 2003 11:46:51 +0000 (11:46 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 15 Sep 2003 11:46:51 +0000 (11:46 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23597 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/toplvcmn.cpp

index dc1a79b9167607485d131bf7a440ed58a7ac392b..7aba62adf9b6e35f55b7b3335679e059e7438cac 100644 (file)
@@ -80,6 +80,19 @@ bool wxTopLevelWindowBase::Destroy()
     if ( !wxPendingDelete.Member(this) )
         wxPendingDelete.Append(this);
 
+    // but hide it immediately
+    Hide();
+
+    // also remove it from the list of parents children so that the loop in
+    // wxWindowBase::DestroyChildren() eventually terminates
+    if ( m_parent )
+    {
+        m_parent->RemoveChild(this);
+
+        // don't do it again in our dtor
+        m_parent = NULL;
+    }
+
     return TRUE;
 }