Always create wxStaticBitmap in the widgets sample

Not creating it when the default image wasn't found resulted in a crash,
so always create wxStaticBitmap using a fallback bitmap if necessary.

Also add a wxCHECK_RET to prevent the crash from happening in a similar
situation in the future.
This commit is contained in:
Vadim Zeitlin
2018-09-22 14:33:29 +02:00
parent 1cf981e243
commit 455a45f5a8
2 changed files with 26 additions and 11 deletions

View File

@@ -680,8 +680,11 @@ void WidgetsFrame::ConnectToWidgetEvents()
it != widgets.end();
++it )
{
(*it)->Bind(wxEVT_SET_FOCUS, &WidgetsFrame::OnWidgetFocus, this);
(*it)->Bind(wxEVT_KILL_FOCUS, &WidgetsFrame::OnWidgetFocus, this);
wxWindow* const w = *it;
wxCHECK_RET(w, "NULL widget");
w->Bind(wxEVT_SET_FOCUS, &WidgetsFrame::OnWidgetFocus, this);
w->Bind(wxEVT_KILL_FOCUS, &WidgetsFrame::OnWidgetFocus, this);
}
}