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

@@ -324,6 +324,7 @@ All:
- Added wxArray::swap(). - Added wxArray::swap().
- Added wxSHUTDOWN_LOGOFF and wxSHUTDOWN_FORCE wxShutdown() flags (troelsk). - Added wxSHUTDOWN_LOGOFF and wxSHUTDOWN_FORCE wxShutdown() flags (troelsk).
- Added wxSocket::ShutdownOutput(). - Added wxSocket::ShutdownOutput().
- Handle exceptions thrown from overridden wxView::OnCreate() gracefully.
All (Unix): All (Unix):

View File

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