diff options
author | Jonas Ådahl <jadahl@gmail.com> | 2019-08-07 19:17:44 +0200 |
---|---|---|
committer | Jonas Ådahl <jadahl@gmail.com> | 2019-08-08 09:05:17 +0200 |
commit | 77bc2dc87c2dbf81854bc95e5da597edb5b5af9d (patch) | |
tree | 32de360fcad681f27b01023ee283acd9af776f8c | |
parent | 01d2ef6c66db2ad2b1bbdc2b8f0073fc76e11f99 (diff) | |
download | gtk+-77bc2dc87c2dbf81854bc95e5da597edb5b5af9d.tar.gz |
gtk/icon-theme: Handle lack of SVG loader gracefully
When loading a SVG icon from a gresource file only containing SVG icons,
but without having a SVG loader available in gdk-pixbuf, we would crash
when trying to eventually load the resource. Fix this by gracefully
handling this by simply failing to load the icon, while the first time
it happens, log a warning.
https://gitlab.gnome.org/GNOME/gtk/issues/2084
-rw-r--r-- | gtk/gtkicontheme.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c index 65c64b38e3..29635b6003 100644 --- a/gtk/gtkicontheme.c +++ b/gtk/gtkicontheme.c @@ -1806,6 +1806,20 @@ real_choose_icon (GtkIconTheme *icon_theme, icon_info->filename = g_strdup (unthemed_icon->svg_filename); else if (unthemed_icon->no_svg_filename) icon_info->filename = g_strdup (unthemed_icon->no_svg_filename); + else + { + static gboolean warned_once = FALSE; + + if (!warned_once) + { + g_warning ("Found an icon but could not load it. " + "Most likely gdk-pixbuf does not provide SVG support."); + warned_once = TRUE; + } + + g_clear_object (&icon_info); + goto out; + } if (unthemed_icon->is_resource) { |