]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/docview.cpp
reSWIGged
[wxWidgets.git] / src / common / docview.cpp
index 9946ac26687d7d0806b1984ee3c7ac4ab094207d..221ce1b1364ab66a3209fe731c1727f3cf1e0d9a 100644 (file)
@@ -1225,7 +1225,12 @@ wxDocument *wxDocManager::CreateDocument(const wxString& path, long flags)
             {
                 newDoc->SetDocumentName(temp->GetDocumentName());
                 newDoc->SetDocumentTemplate(temp);
-                newDoc->OnNewDocument();
+                if (!newDoc->OnNewDocument() )
+                {
+                     // Document is implicitly deleted by DeleteAllViews
+                     newDoc->DeleteAllViews();
+                     return NULL;
+                }
             }
             return newDoc;
         }
@@ -1248,7 +1253,12 @@ wxDocument *wxDocManager::CreateDocument(const wxString& path, long flags)
             {
                 newDoc->SetDocumentName(temp->GetDocumentName());
                 newDoc->SetDocumentTemplate(temp);
-                newDoc->OnNewDocument();
+                if (!newDoc->OnNewDocument() )
+                {
+                     // Document is implicitly deleted by DeleteAllViews
+                     newDoc->DeleteAllViews();
+                     return NULL;
+                }
             }
             return newDoc;
         }