Avoid crash on abnormal exit in wx+MFC combined applications

Reset m_pMainWnd in wxMFCApp::ExitInstance() to avoid crash when
deleting it again in OnMainWindowDestroyed() that could happen if
ExitInstance() was called not because the main window was closed (normal
case) but because wxApp::ExitMainLoop() was called, as it happens when
an unhandled exception is thrown.
This commit is contained in:
Vadim Zeitlin
2018-01-17 11:32:07 +01:00
parent 6c7e5a9200
commit 35a0ba4fce

View File

@@ -81,6 +81,7 @@ public:
int ExitInstance() wxOVERRIDE
{
delete m_pMainWnd;
m_pMainWnd = NULL;
if ( wxTheApp )
wxTheApp->OnExit();