fepitre / rpms / gtk3

Forked from rpms/gtk3 4 years ago
Clone

Blame SOURCES/0001-gtk-icon-theme-Handle-lack-of-SVG-loader-gracefully.patch

0d24c4
From e08c019f6c01a797c3eef59d900fbe09fac9ddaf Mon Sep 17 00:00:00 2001
0d24c4
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
0d24c4
Date: Wed, 7 Aug 2019 19:17:44 +0200
0d24c4
Subject: [PATCH] gtk/icon-theme: Handle lack of SVG loader gracefully
0d24c4
0d24c4
When loading a SVG icon from a gresource file only containing SVG icons,
0d24c4
but without having a SVG loader available in gdk-pixbuf, we would crash
0d24c4
when trying to eventually load the resource. Fix this by gracefully
0d24c4
handling this by simply failing to load the icon, while the first time
0d24c4
it happens, log a warning.
0d24c4
0d24c4
https://gitlab.gnome.org/GNOME/gtk/issues/2084
0d24c4
---
0d24c4
 gtk/gtkicontheme.c | 13 +++++++++++++
0d24c4
 1 file changed, 13 insertions(+)
0d24c4
0d24c4
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
0d24c4
index 65c64b38e3..e5323defe8 100644
0d24c4
--- a/gtk/gtkicontheme.c
0d24c4
+++ b/gtk/gtkicontheme.c
0d24c4
@@ -1806,6 +1806,19 @@ real_choose_icon (GtkIconTheme       *icon_theme,
0d24c4
         icon_info->filename = g_strdup (unthemed_icon->svg_filename);
0d24c4
       else if (unthemed_icon->no_svg_filename)
0d24c4
         icon_info->filename = g_strdup (unthemed_icon->no_svg_filename);
0d24c4
+      else
0d24c4
+        {
0d24c4
+          static gboolean warned_once = FALSE;
0d24c4
+
0d24c4
+          if (!warned_once)
0d24c4
+            {
0d24c4
+              g_warning ("Tried to load SVG only icon without SVG support");
0d24c4
+              warned_once = TRUE;
0d24c4
+            }
0d24c4
+
0d24c4
+          g_clear_object (&icon_info);
0d24c4
+          goto out;
0d24c4
+        }
0d24c4
 
0d24c4
       if (unthemed_icon->is_resource)
0d24c4
         {
0d24c4
-- 
0d24c4
2.21.0
0d24c4