handle exceptions thrown from overridden wxView::OnCreate() gracefully

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57671 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-12-30 16:36:39 +00:00
parent f17632706e
commit 7047d7981f
2 changed files with 7 additions and 10 deletions

View File

@@ -57,6 +57,7 @@
#include "wx/tokenzr.h"
#include "wx/filename.h"
#include "wx/vector.h"
#include "wx/ptr_scpd.h"
#if wxUSE_STD_IOSTREAM
#include "wx/ioswrap.h"
@@ -779,20 +780,15 @@ wxDocTemplate::InitDocument(wxDocument* doc, const wxString& path, long flags)
wxView *wxDocTemplate::CreateView(wxDocument *doc, long flags)
{
wxView *view = DoCreateView();
if ( view == NULL )
wxScopedPtr<wxView> view(DoCreateView());
if ( !view )
return NULL;
view->SetDocument(doc);
if (view->OnCreate(doc, flags))
{
return view;
}
else
{
delete view;
if ( !view->OnCreate(doc, flags) )
return NULL;
}
return view.release();
}
// The default (very primitive) format detection: check is the extension is