X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/265db88d614412556eaf6671f442ca44d9f19b70..1abfa172c547a37751e598084fb8d541071471a3:/src/common/init.cpp diff --git a/src/common/init.cpp b/src/common/init.cpp index bb5693e4a9..ee24148576 100644 --- a/src/common/init.cpp +++ b/src/common/init.cpp @@ -220,6 +220,9 @@ static void FreeConvertedArgs() static bool DoCommonPreInit() { #if wxUSE_LOG + // Reset logging in case we were cleaned up and are being reinitialized. + wxLog::DoCreateOnDemand(); + // install temporary log sink: we can't use wxLogGui before wxApp is // constructed and if we use wxLogStderr, all messages during // initialization simply disappear under Windows @@ -391,8 +394,12 @@ void wxEntryCleanup() { wxTheApp->CleanUp(); - delete wxTheApp; + // reset the global pointer to it to NULL before destroying it as in + // some circumstances this can result in executing the code using + // wxTheApp and using half-destroyed object is no good + wxAppConsole * const app = wxApp::GetInstance(); wxApp::SetInstance(NULL); + delete app; }