Avoid Gtk-CRITICAL with GTK3 when calling SetFont() before Create()

This commit is contained in:
Paul Cornett 2020-04-29 07:35:44 -07:00
parent b3730a59c6
commit af5950c108

View File

@ -60,7 +60,7 @@ bool wxControl::Create( wxWindow *parent,
bool wxControl::SetFont(const wxFont& font)
{
const bool changed = base_type::SetFont(font);
if (changed && !gtk_widget_get_realized(m_widget) && gtk_check_version(3,5,0))
if (changed && m_widget && !gtk_widget_get_realized(m_widget) && gtk_check_version(3,5,0))
{
// GTK defers sending "style-updated" until widget is realized, but
// GetBestSize() won't compute correct result until the signal is sent,