From 230b038d5079fda7f0cdb72ef047dac5135ec252 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 16 Jan 2014 21:33:19 +0000 Subject: [PATCH] Avoid automatically closing parent frame if a child dialog was closed. This counterintuitive behaviour could happen when a dialog of a frame returning false from its ShouldPreventAppExit() was closed: if there were no other TLWs in the application, then the parent frame could be closed as well, even if this clearly shouldn't happen. See #15880. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@75630 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/toplvcmn.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/common/toplvcmn.cpp b/src/common/toplvcmn.cpp index 03504cc0fe..11920925f2 100644 --- a/src/common/toplvcmn.cpp +++ b/src/common/toplvcmn.cpp @@ -138,6 +138,13 @@ bool wxTopLevelWindowBase::IsLastBeforeExit() const if ( !wxTheApp || !wxTheApp->GetExitOnFrameDelete() ) return false; + // second, never terminate the application after closing a child TLW + // because this would close its parent unexpectedly -- notice that this + // check is not redundant with the loop below, as the parent might return + // false from its ShouldPreventAppExit() + if ( GetParent() ) + return false; + wxWindowList::const_iterator i; const wxWindowList::const_iterator end = wxTopLevelWindows.end();