X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9cc7a35d9c1a054a8f88dcf7b51347e95f4a2557..75737d0570103dbb9de120e77d0ce3154510ece9:/src/gtk/app.cpp diff --git a/src/gtk/app.cpp b/src/gtk/app.cpp index 5c08aad9d6..e3bb20d00d 100644 --- a/src/gtk/app.cpp +++ b/src/gtk/app.cpp @@ -581,39 +581,45 @@ int wxEntry( int argc, char *argv[] ) wxStripExtension( name ); wxTheApp->SetAppName( name ); - if (!wxTheApp->OnInitGui()) - return 0; + int retValue = 0; + + if ( !wxTheApp->OnInitGui() ) + retValue = -1; // Here frames insert themselves automatically into wxTopLevelWindows by // getting created in OnInit(). - if (!wxTheApp->OnInit()) - return 0; - - wxTheApp->m_initialized = wxTopLevelWindows.GetCount() != 0; + if ( retValue == 0 ) + { + if ( !wxTheApp->OnInit() ) + retValue = -1; + } - int retValue = 0; + if ( retValue == 0 ) + { + wxTheApp->m_initialized = wxTopLevelWindows.GetCount() != 0; - if (wxTheApp->Initialized()) - retValue = wxTheApp->OnRun(); + if (wxTheApp->Initialized()) + retValue = wxTheApp->OnRun(); - wxWindow *topWindow = wxTheApp->GetTopWindow(); - if (topWindow) - { - // Forcibly delete the window. - if (topWindow->IsKindOf(CLASSINFO(wxFrame)) || - topWindow->IsKindOf(CLASSINFO(wxDialog)) ) + wxWindow *topWindow = wxTheApp->GetTopWindow(); + if (topWindow) { - topWindow->Close( TRUE ); - wxTheApp->DeletePendingObjects(); - } - else - { - delete topWindow; - wxTheApp->SetTopWindow( (wxWindow*) NULL ); + // Forcibly delete the window. + if (topWindow->IsKindOf(CLASSINFO(wxFrame)) || + topWindow->IsKindOf(CLASSINFO(wxDialog)) ) + { + topWindow->Close( TRUE ); + wxTheApp->DeletePendingObjects(); + } + else + { + delete topWindow; + wxTheApp->SetTopWindow( (wxWindow*) NULL ); + } } - } - wxTheApp->OnExit(); + wxTheApp->OnExit(); + } // flush the logged messages if any wxLog *log = wxLog::GetActiveTarget();