[gtk+] IconHelper: Avoid warnings for non-existing stock ids



commit 444a92d6d833c0254d554e64e393bfc823d3555f
Author: Alexander Larsson <alexl redhat com>
Date:   Thu Dec 13 10:08:37 2012 +0100

    IconHelper: Avoid warnings for non-existing stock ids
    
    There are some registred stock ids like gtk-discards that have no icons,
    and you could also pass a non-registred stock id. Both of these means
    gtk_style_context_lookup_icon_set returns NULL, which causes
    a critical in gtk_icon_set_render_icon_pixbuf.
    
    We avoid this by just making these render as EMPTY.

 gtk/gtkiconhelper.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkiconhelper.c b/gtk/gtkiconhelper.c
index 6f23914..74eae69 100644
--- a/gtk/gtkiconhelper.c
+++ b/gtk/gtkiconhelper.c
@@ -325,7 +325,10 @@ _gtk_icon_helper_ensure_pixbuf (GtkIconHelper *self,
 
     case GTK_IMAGE_STOCK:
       icon_set = gtk_style_context_lookup_icon_set (context, self->priv->stock_id);
-      ensure_pixbuf_for_icon_set (self, context, icon_set);
+      if (icon_set != NULL)
+	ensure_pixbuf_for_icon_set (self, context, icon_set);
+      else
+	pixbuf = NULL;
       break;
 
     case GTK_IMAGE_ICON_SET:



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