From b8ea9cd5831ee80741f0d819c17e612bbbebd235 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Wed, 16 Feb 2011 21:31:33 +0000 Subject: [PATCH] Allow m_docManager to be NULL (patch #12435) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@66911 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/docmdi.cpp | 16 +++++++++------- src/common/docview.cpp | 9 ++++++--- 2 files changed, 15 insertions(+), 10 deletions(-) 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