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:
@@ -81,6 +81,7 @@ public:
|
|||||||
int ExitInstance() wxOVERRIDE
|
int ExitInstance() wxOVERRIDE
|
||||||
{
|
{
|
||||||
delete m_pMainWnd;
|
delete m_pMainWnd;
|
||||||
|
m_pMainWnd = NULL;
|
||||||
|
|
||||||
if ( wxTheApp )
|
if ( wxTheApp )
|
||||||
wxTheApp->OnExit();
|
wxTheApp->OnExit();
|
||||||
|
Reference in New Issue
Block a user