diff --git a/src/common/docmdi.cpp b/src/common/docmdi.cpp index 29f89756d0..2beef44f1b 100644 --- a/src/common/docmdi.cpp +++ b/src/common/docmdi.cpp @@ -80,15 +80,17 @@ bool wxDocMDIParentFrame::ProcessEvent(wxEvent& event) void wxDocMDIParentFrame::OnCloseWindow(wxCloseEvent& event) { - if (m_docManager->Clear(!event.CanVeto())) - { - this->Destroy(); - } - else - event.Veto(); + if ( m_docManager && !m_docManager->Clear(!event.CanVeto()) ) + { + // The user decided not to close finally, abort. + event.Veto(); + } + else + { + this->Destroy(); + } } - /* * Default document child frame for MDI children */ diff --git a/src/common/docview.cpp b/src/common/docview.cpp index f86e650727..d53f01c9d4 100644 --- a/src/common/docview.cpp +++ b/src/common/docview.cpp @@ -2010,12 +2010,15 @@ bool wxDocParentFrame::ProcessEvent(wxEvent& event) // - must delete all frames except for the main one. void wxDocParentFrame::OnCloseWindow(wxCloseEvent& event) { - if (m_docManager->Clear(!event.CanVeto())) + if ( m_docManager && !m_docManager->Clear(!event.CanVeto()) ) + { + // The user decided not to close finally, abort. + event.Veto(); + } + else { this->Destroy(); } - else - event.Veto(); } #if wxUSE_PRINTING_ARCHITECTURE