From 69ff70b69368bba2aa1b2e816c5781fea30d8dd7 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 3 Dec 2013 14:53:46 +0000 Subject: [PATCH] Fix crash when Destroy()-ing a TLW with a non-TLW parent. Generalize the code in wxTopLevelWindowBase dtor checking for the children of the TLW being destroyed pending for deletion themselves to work when the child TLW is an indirect child, i.e. was created with a child window of this TLW as parent and not this TLW itself. Closes #15743. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@75341 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/common/toplvcmn.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/changes.txt b/docs/changes.txt index 90c27e6c19..77931bceee 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -587,6 +587,7 @@ All (GUI): in 64 bit builds (Tom Mettam, Rapid2D). - Fix wxCommandProcessor::IsDirty() return value which was wrong after undoing all commands without saving (Neil Chittenden). +- Fix crash when Destroy()-ing a TLW with non-TLW parent. wxGTK: diff --git a/src/common/toplvcmn.cpp b/src/common/toplvcmn.cpp index b5d3e5e39d..03504cc0fe 100644 --- a/src/common/toplvcmn.cpp +++ b/src/common/toplvcmn.cpp @@ -76,7 +76,7 @@ wxTopLevelWindowBase::~wxTopLevelWindowBase() ) { wxWindow * const win = wxDynamicCast(*i, wxWindow); - if ( win && win->GetParent() == this ) + if ( win && wxGetTopLevelParent(win->GetParent()) == this ) { wxPendingDelete.erase(i);