X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9f4cc34f375fbff74006f3057e90dd01c426f580..75d9e502238df95fa53c0030b1fac0d4f43e4025:/wxPython/wx/lib/docview.py diff --git a/wxPython/wx/lib/docview.py b/wxPython/wx/lib/docview.py index 8f85b4be2f..92206c1020 100644 --- a/wxPython/wx/lib/docview.py +++ b/wxPython/wx/lib/docview.py @@ -1387,7 +1387,8 @@ class DocManager(wx.EvtHandler): for document in self._docs[::-1]: # Close in lifo (reverse) order. We clone the list to make sure we go through all docs even as they are deleted if not self.CloseDocument(document, force): return False - document.DeleteAllViews() # Implicitly delete the document when the last view is removed + if document: + document.DeleteAllViews() # Implicitly delete the document when the last view is removed return True @@ -1919,8 +1920,8 @@ class DocManager(wx.EvtHandler): newDoc.SetDocumentName(temp.GetDocumentName()) newDoc.SetDocumentTemplate(temp) if not newDoc.OnOpenDocument(path): - newDoc.DeleteAllViews() # Implicitly deleted by DeleteAllViews frame = newDoc.GetFirstView().GetFrame() + newDoc.DeleteAllViews() # Implicitly deleted by DeleteAllViews if frame: frame.Destroy() # DeleteAllViews doesn't get rid of the frame, so we'll explicitly destroy it. return None