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
This commit is contained in:
Julian Smart
2000-07-13 17:43:52 +00:00
parent 5016f35584
commit f656067f27

View File

@@ -130,6 +130,7 @@ wxDocument::wxDocument(wxDocument *parent)
m_documentModified = FALSE; m_documentModified = FALSE;
m_documentParent = parent; m_documentParent = parent;
m_documentTemplate = (wxDocTemplate *) NULL; m_documentTemplate = (wxDocTemplate *) NULL;
m_commandProcessor = (wxCommandProcessor*) NULL;
m_savedYet = FALSE; m_savedYet = FALSE;
} }
@@ -145,6 +146,7 @@ wxDocument::~wxDocument()
if (m_commandProcessor) if (m_commandProcessor)
delete m_commandProcessor; delete m_commandProcessor;
if (GetDocumentManager())
GetDocumentManager()->RemoveDocument(this); GetDocumentManager()->RemoveDocument(this);
// Not safe to do here, since it'll invoke virtual view functions // Not safe to do here, since it'll invoke virtual view functions
@@ -188,7 +190,7 @@ bool wxDocument::DeleteAllViews()
} }
// If we haven't yet deleted the document (for example // If we haven't yet deleted the document (for example
// if there were no views) then delete it. // if there were no views) then delete it.
if (manager->GetDocuments().Member(this)) if (manager && manager->GetDocuments().Member(this))
delete this; delete this;
return TRUE; return TRUE;
@@ -203,7 +205,7 @@ wxView *wxDocument::GetFirstView() const
wxDocManager *wxDocument::GetDocumentManager() const wxDocManager *wxDocument::GetDocumentManager() const
{ {
return m_documentTemplate->GetDocumentManager(); return (m_documentTemplate ? m_documentTemplate->GetDocumentManager() : (wxDocManager*) NULL);
} }
bool wxDocument::OnNewDocument() bool wxDocument::OnNewDocument()