X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e94cd97dd7db345ab4c9abb911cf4396fcac3335..601398b9b1e63109f44af34ff79bc558fe929b4d:/src/common/init.cpp diff --git a/src/common/init.cpp b/src/common/init.cpp index 639a614add..326ef09333 100644 --- a/src/common/init.cpp +++ b/src/common/init.cpp @@ -27,12 +27,12 @@ #include "wx/app.h" #include "wx/filefn.h" #include "wx/log.h" - #include "wx/thread.h" #include "wx/intl.h" #include "wx/module.h" #endif #include "wx/init.h" +#include "wx/thread.h" #include "wx/ptr_scpd.h" #include "wx/except.h" @@ -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; }