[gtk+] iconhelper: Invalidate style before accessing texture



commit 1d845557297ddd114bb6e2c8d2332895967c9d42
Author: Benjamin Otte <otte redhat com>
Date:   Fri Dec 23 23:16:30 2016 +0100

    iconhelper: Invalidate style before accessing texture
    
    Invalidating the style might cause invalidation of the texture. So we
    end up with a pointer to freed memory.
    SAD!

 gtk/gtkiconhelper.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkiconhelper.c b/gtk/gtkiconhelper.c
index 82576fd..9f3cdb1 100644
--- a/gtk/gtkiconhelper.c
+++ b/gtk/gtkiconhelper.c
@@ -873,13 +873,13 @@ gtk_icon_helper_snapshot (GtkIconHelper *self,
   GtkCssStyle *style;
   GskTexture *texture;
 
+  style = gtk_css_node_get_style (gtk_css_gadget_get_node (GTK_CSS_GADGET (self)));
+
   gtk_icon_helper_ensure_texture (self);
   texture = self->priv->texture;
   if (texture == NULL)
     return;
  
-  style = gtk_css_node_get_style (gtk_css_gadget_get_node (GTK_CSS_GADGET (self)));
-
   gtk_css_style_snapshot_icon_texture (style,
                                        snapshot,
                                        texture,


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