[gtk: 1/2] gtkstylecontext: guard against gtk_css_widget_node_get_widget() returning NULL in more places



commit f440c48deab698057800d8e74de14c6589499df0
Author: Christoph Reiter <creiter src gnome org>
Date:   Mon Mar 19 18:21:25 2018 +0100

    gtkstylecontext: guard against gtk_css_widget_node_get_widget() returning NULL in more places
    
    When the widget gets finalized it clears the widgetnode and gtk_css_widget_node_get_widget
    returns NULL. Guard against gtk_css_widget_node_get_widget() returning NULL like in other
    places.
    
    See https://gitlab.gnome.org/GNOME/pygobject/issues/28#note_82862

 gtk/gtkstylecontext.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 16897067d0..5ea19b3d7b 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -170,7 +170,11 @@ gtk_style_context_real_changed (GtkStyleContext *context)
   GtkStyleContextPrivate *priv = gtk_style_context_get_instance_private (context);
 
   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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]