Don't crash when creating wxStaticBox in wxGTK.
Since r74585, wxWindow::SetCanFocus() is called from wxStaticBoxBase ctor, i.e. before the real window is created, and this results in a crash in wxGTK where SetCanFocus() needs a valid widget. Fix this simply by doing nothing in SetCanFocus() if the widget is not created yet as this should result in the same behaviour as before r74585. This doesn't seem like the right thing to do, however, and we should probably remove this call from wxStaticBoxBase ctor and do it in wxStaticBox implementation itself instead. Closes #15358. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74594 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -3376,7 +3376,8 @@ void wxWindowGTK::SetFocus()
|
||||
|
||||
void wxWindowGTK::SetCanFocus(bool canFocus)
|
||||
{
|
||||
gtk_widget_set_can_focus(m_widget, canFocus);
|
||||
if ( m_widget )
|
||||
gtk_widget_set_can_focus(m_widget, canFocus);
|
||||
|
||||
if ( m_wxwindow && (m_widget != m_wxwindow) )
|
||||
{
|
||||
|
Reference in New Issue
Block a user