From e91fb2bbee30c9e4423747a25c875dbcd2473e34 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 5 Dec 2014 22:18:13 +0000 Subject: [PATCH] Fix crash when using wxMessageBox before creating wxTheApp. CheckIfCanBeUsedAsParent() used by wxMessageBox ctor shouldn't dereference wxTheApp unconditionally, otherwise it's impossible to show a message box before creating the application object or after destroying it without crashing. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78233 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/dlgcmn.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/dlgcmn.cpp b/src/common/dlgcmn.cpp index 6eecb6d0ce..f08e19d175 100644 --- a/src/common/dlgcmn.cpp +++ b/src/common/dlgcmn.cpp @@ -189,7 +189,7 @@ wxDialogBase::GetParentForModalDialog(wxWindow *parent, long style) const wxGetTopLevelParent(wxGetActiveWindow())); // and finally the application main window - if ( !parent ) + if ( !parent && wxTheApp ) parent = CheckIfCanBeUsedAsParent(wxTheApp->GetTopWindow()); return parent;