Merge branch 'style-context-null-widget-guard' into 'gtk-3-22'

gtkstylecontext: guard against gtk_css_widget_node_get_widget() returning NULL in more places

See merge request GNOME/gtk!70
This commit is contained in:
Benjamin Otte 2018-03-20 14:55:57 +00:00
commit 9781ffae51

View File

@ -187,7 +187,11 @@ gtk_style_context_real_changed (GtkStyleContext *context)
GtkStyleContextPrivate *priv = context->priv; GtkStyleContextPrivate *priv = context->priv;
if (GTK_IS_CSS_WIDGET_NODE (priv->cssnode)) if (GTK_IS_CSS_WIDGET_NODE (priv->cssnode))
_gtk_widget_style_context_invalidated (gtk_css_widget_node_get_widget (GTK_CSS_WIDGET_NODE (priv->cssnode))); {
GtkWidget *widget = gtk_css_widget_node_get_widget (GTK_CSS_WIDGET_NODE (priv->cssnode));
if (widget != NULL)
_gtk_widget_style_context_invalidated (widget);
}
} }
static void static void
@ -522,7 +526,8 @@ gtk_style_context_push_state (GtkStyleContext *context,
{ {
GtkWidget *widget = gtk_css_widget_node_get_widget (GTK_CSS_WIDGET_NODE (root)); GtkWidget *widget = gtk_css_widget_node_get_widget (GTK_CSS_WIDGET_NODE (root));
g_debug ("State %u for %s %p doesn't match state %u set via gtk_style_context_set_state ()", g_debug ("State %u for %s %p doesn't match state %u set via gtk_style_context_set_state ()",
state, gtk_widget_get_name (widget), widget, gtk_css_node_get_state (priv->cssnode)); state, (widget == NULL) ? "(null)" : gtk_widget_get_name (widget),
widget, gtk_css_node_get_state (priv->cssnode));
} }
else else
{ {