Allow documents without template nor views be deleted correctly again.

The changes of r78282 didn't take into account the case of a document without
any views nor template and, consequently, without the associated manager. Such
documents were not deleted at all any longer.

Fix this by ensuring that a document is always associated with a manager: if
not with the one specified by its template, then with the global one.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78453 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2015-02-06 19:28:46 +00:00
parent 322a55e63d
commit 4acf5bc1bd

View File

@@ -276,7 +276,13 @@ wxDocManager *wxDocument::GetDocumentManager() const
if ( m_documentParent )
return m_documentParent->GetDocumentManager();
return m_documentTemplate ? m_documentTemplate->GetDocumentManager() : NULL;
if ( m_documentTemplate )
return m_documentTemplate->GetDocumentManager();
// Fall back on the global manager if the document doesn't have a template,
// code elsewhere, notably in DeleteAllViews(), relies on the document
// always being managed by some manager.
return wxDocManager::GetDocumentManager();
}
bool wxDocument::OnNewDocument()