the app doesn't exit any more if a dialog is shown (and destroyed) while

the flow of control is still in OnInit()


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16523 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2002-08-15 20:42:07 +00:00
parent 62b77e42be
commit 1cbee0b42c
10 changed files with 134 additions and 89 deletions

View File

@@ -60,7 +60,19 @@ wxTopLevelWindowBase::wxTopLevelWindowBase()
wxTopLevelWindowBase::~wxTopLevelWindowBase()
{
// this destructor is required for Darwin
// don't let wxTheApp keep any stale pointers to us
if ( wxTheApp && wxTheApp->GetTopWindow() == this )
wxTheApp->SetTopWindow(NULL);
bool shouldExit = IsLastBeforeExit();
wxTopLevelWindows.DeleteObject(this);
if ( shouldExit )
{
// then do it
wxTheApp->ExitMainLoop();
}
}
bool wxTopLevelWindowBase::Destroy()
@@ -73,6 +85,19 @@ bool wxTopLevelWindowBase::Destroy()
return TRUE;
}
/* static */
bool wxTopLevelWindowBase::IsLastBeforeExit()
{
// we exit the application if there are no more top level windows left
// normally but wxApp can prevent this from happening
return (wxTopLevelWindows.GetCount() == 1) &&
wxTheApp && wxTheApp->GetExitOnFrameDelete();
}
// ----------------------------------------------------------------------------
// wxTopLevelWindow geometry
// ----------------------------------------------------------------------------
wxSize wxTopLevelWindowBase::GetMaxSize() const
{
wxSize size( GetMaxWidth(), GetMaxHeight() );