[PATCH 1/2] Improve the SpokeSelector icon error reporting.

David Shea dshea at redhat.com
Fri Jun 13 17:31:47 UTC 2014


Also we were missing a couple of frees.
---
 widgets/src/SpokeSelector.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/widgets/src/SpokeSelector.c b/widgets/src/SpokeSelector.c
index 2486071..5866a23 100644
--- a/widgets/src/SpokeSelector.c
+++ b/widgets/src/SpokeSelector.c
@@ -239,7 +239,23 @@ static void set_icon(AnacondaSpokeSelector *widget, const char *icon_name) {
     icon_info = gtk_icon_theme_lookup_by_gicon(icon_theme,
                                                icon,
                                                64, 0);
+    if (NULL == icon_info) {
+        gchar *icon_str = g_icon_to_string(icon);
+        fprintf(stderr, "unable to lookup icon %s\n", icon_str);
+        if (NULL != icon_str) {
+            g_free(icon_str);
+        }
+        return;
+    }
+
     pixbuf = gtk_icon_info_load_icon(icon_info, NULL);
+    g_object_unref(icon_info);
+
+    if (NULL == pixbuf) {
+        fprintf(stderr, "could not load icon: %s\n", err->message);
+        g_error_free(err);
+        return;
+    }
 
     widget->priv->icon = gtk_image_new_from_pixbuf(pixbuf);
     gtk_image_set_pixel_size(GTK_IMAGE(widget->priv->icon), 64);
-- 
2.0.0



More information about the anaconda-patches mailing list