reverted the delete/Destroy() change in DestroyChildren()
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 16 Sep 2003 12:35:13 +0000 (12:35 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 16 Sep 2003 12:35:13 +0000 (12:35 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23619 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/toplvcmn.cpp
src/common/wincmn.cpp

index 7aba62adf9b6e35f55b7b3335679e059e7438cac..71bc0468d3ba3af893e7a2248ee8560176c0c147 100644 (file)
@@ -83,16 +83,6 @@ bool wxTopLevelWindowBase::Destroy()
     // 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;
 }
 
index dc4f307488a4e1710d45291fd2c15e7d5a27a72c..6d770e2aa3659889ed22491a68c8483aebbb3797 100644 (file)
@@ -348,7 +348,11 @@ bool wxWindowBase::DestroyChildren()
 
         wxWindow *child = node->GetData();
 
-        child->Destroy();
+        // note that we really want to call delete and not ->Destroy() here
+        // because we want to delete the child immediately, before we are
+        // deleted, and delayed deletion would result in problems as our (top
+        // level) child could outlive its parent
+        delete child;
 
         wxASSERT_MSG( !GetChildren().Find(child),
                       wxT("child didn't remove itself using RemoveChild()") );