From 12f69f76033f16d96fafa686a79729cd52a59f2d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 16 May 2015 16:01:52 +0200 Subject: [PATCH] Add a check for wxWindow::Create() success to wxXRC. Give an error in a very unlikely but still possible case that the window creation failed before setting it up. --- src/xrc/xmlres.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/xrc/xmlres.cpp b/src/xrc/xmlres.cpp index 6e90acb3af..cdb43b078a 100644 --- a/src/xrc/xmlres.cpp +++ b/src/xrc/xmlres.cpp @@ -2433,6 +2433,16 @@ wxFont wxXmlResourceHandlerImpl::GetFont(const wxString& param, wxWindow* parent void wxXmlResourceHandlerImpl::SetupWindow(wxWindow *wnd) { + // This is called immediately after creating a window, so it's a convenient + // place to check that it was created successfully without duplicating this + // check in all handlers. + if ( !wnd->GetHandle() ) + { + wxLogError(_("Creating %s \"%s\" failed."), + m_handler->m_class, GetName()); + return; + } + //FIXME : add cursor const wxString variant = GetParamValue(wxS("variant"));