From 55759171de0c06ad19cb99169f43c471a22e83d5 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 16 Jan 2014 21:44:47 +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/trunk@75633 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 fc1609e06c..d1700c3503 100644 --- a/src/common/toplvcmn.cpp +++ b/src/common/toplvcmn.cpp @@ -148,6 +148,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();