From f303564dbdcd15b2a7a5da3cc8a6c1fc23f0a93a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 16 Sep 2003 12:35:13 +0000 Subject: [PATCH] reverted the delete/Destroy() change in DestroyChildren() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23619 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/toplvcmn.cpp | 10 ---------- src/common/wincmn.cpp | 6 +++++- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/common/toplvcmn.cpp b/src/common/toplvcmn.cpp index 7aba62adf9..71bc0468d3 100644 --- a/src/common/toplvcmn.cpp +++ b/src/common/toplvcmn.cpp @@ -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; } diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index dc4f307488..6d770e2aa3 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -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()") ); -- 2.49.0