From 0151c3eb43458ff479c33108a6916670c4f68cd2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 15 Apr 1999 19:16:19 +0000 Subject: [PATCH] log messages given during program initialization are not discarded any more git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2188 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/app.cpp | 60 ++++++++++++++++++++++++++---------------------- src/gtk1/app.cpp | 60 ++++++++++++++++++++++++++---------------------- 2 files changed, 66 insertions(+), 54 deletions(-) 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; - - int retValue = 0; - - if (wxTheApp->Initialized()) - retValue = wxTheApp->OnRun(); - - wxWindow *topWindow = wxTheApp->GetTopWindow(); - if (topWindow) + if ( retValue == 0 ) { - // 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 ); - } + if ( !wxTheApp->OnInit() ) + retValue = -1; } - wxTheApp->OnExit(); + if ( retValue == 0 ) + { + wxTheApp->m_initialized = wxTopLevelWindows.GetCount() != 0; + + 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)) ) + { + topWindow->Close( TRUE ); + wxTheApp->DeletePendingObjects(); + } + else + { + delete topWindow; + wxTheApp->SetTopWindow( (wxWindow*) NULL ); + } + } + + wxTheApp->OnExit(); + } // flush the logged messages if any wxLog *log = wxLog::GetActiveTarget(); diff --git a/src/gtk1/app.cpp b/src/gtk1/app.cpp index 5c08aad9d6..e3bb20d00d 100644 --- a/src/gtk1/app.cpp +++ b/src/gtk1/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; - - int retValue = 0; - - if (wxTheApp->Initialized()) - retValue = wxTheApp->OnRun(); - - wxWindow *topWindow = wxTheApp->GetTopWindow(); - if (topWindow) + if ( retValue == 0 ) { - // 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 ); - } + if ( !wxTheApp->OnInit() ) + retValue = -1; } - wxTheApp->OnExit(); + if ( retValue == 0 ) + { + wxTheApp->m_initialized = wxTopLevelWindows.GetCount() != 0; + + 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)) ) + { + topWindow->Close( TRUE ); + wxTheApp->DeletePendingObjects(); + } + else + { + delete topWindow; + wxTheApp->SetTopWindow( (wxWindow*) NULL ); + } + } + + wxTheApp->OnExit(); + } // flush the logged messages if any wxLog *log = wxLog::GetActiveTarget();