From f656067f27a1ea9031e452c59713bc298fbcabd2 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Thu, 13 Jul 2000 17:43:52 +0000 Subject: [PATCH] Initialized variable in wxDocument constructor git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7738 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/docview.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/common/docview.cpp b/src/common/docview.cpp index a71312e513..8c4479393e 100644 --- a/src/common/docview.cpp +++ b/src/common/docview.cpp @@ -130,6 +130,7 @@ wxDocument::wxDocument(wxDocument *parent) m_documentModified = FALSE; m_documentParent = parent; m_documentTemplate = (wxDocTemplate *) NULL; + m_commandProcessor = (wxCommandProcessor*) NULL; m_savedYet = FALSE; } @@ -145,7 +146,8 @@ wxDocument::~wxDocument() if (m_commandProcessor) delete m_commandProcessor; - GetDocumentManager()->RemoveDocument(this); + if (GetDocumentManager()) + GetDocumentManager()->RemoveDocument(this); // Not safe to do here, since it'll invoke virtual view functions // expecting to see valid derived objects: and by the time we get here, @@ -188,7 +190,7 @@ bool wxDocument::DeleteAllViews() } // If we haven't yet deleted the document (for example // if there were no views) then delete it. - if (manager->GetDocuments().Member(this)) + if (manager && manager->GetDocuments().Member(this)) delete this; return TRUE; @@ -203,7 +205,7 @@ wxView *wxDocument::GetFirstView() const wxDocManager *wxDocument::GetDocumentManager() const { - return m_documentTemplate->GetDocumentManager(); + return (m_documentTemplate ? m_documentTemplate->GetDocumentManager() : (wxDocManager*) NULL); } bool wxDocument::OnNewDocument()