X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e94cd97dd7db345ab4c9abb911cf4396fcac3335..1abfa172c547a37751e598084fb8d541071471a3:/src/common/init.cpp diff --git a/src/common/init.cpp b/src/common/init.cpp index 639a614add..ee24148576 100644 --- a/src/common/init.cpp +++ b/src/common/init.cpp @@ -394,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; }