]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/wx/lib/docview.py
Remove const bool
[wxWidgets.git] / wxPython / wx / lib / docview.py
index 8f85b4be2fbea554c3b60311d4854262bfca9778..92206c10205a3ce34fe616fcf8a51fef5a92d4b8 100644 (file)
@@ -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