[gtk+] icon theme: Fix crash for builtin icons
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] icon theme: Fix crash for builtin icons
- Date: Tue, 17 Jun 2014 17:55:05 +0000 (UTC)
commit 3574a809fa66a125cd148a5adc29e047bada7414
Author: Alexander Larsson <alexl redhat com>
Date: Tue Jun 17 18:05:22 2014 +0200
icon theme: Fix crash for builtin icons
This pushes the initialization of is_svg to an earlier point
when the GtkIconInfo is created. This is needed because an icon
info doesn't necessarily always have a filename that we can later
extract the suffix from. For instance, builtin icons have NULL
filename.
https://bugzilla.gnome.org/show_bug.cgi?id=721895
gtk/gtkicontheme.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
index a6c7754..8b6dca3 100644
--- a/gtk/gtkicontheme.c
+++ b/gtk/gtkicontheme.c
@@ -1756,12 +1756,12 @@ real_choose_icon (GtkIconTheme *icon_theme,
icon_info->filename = g_strdup (unthemed_icon->no_svg_filename);
icon_info->icon_file = g_file_new_for_path (icon_info->filename);
+ icon_info->is_svg = suffix_from_name (icon_info->filename) == ICON_SUFFIX_SVG;
}
out:
if (icon_info)
{
- icon_info->is_svg = (suffix_from_name (icon_info->filename) == ICON_SUFFIX_SVG);
icon_info->desired_size = size;
icon_info->desired_scale = scale;
icon_info->forced_size = (flags & GTK_ICON_LOOKUP_FORCE_SIZE) != 0;
@@ -3030,6 +3030,7 @@ theme_lookup_icon (IconTheme *theme,
file = g_strconcat (icon_name, string_from_suffix (suffix), NULL);
icon_info->filename = g_build_filename (min_dir->dir, file, NULL);
icon_info->icon_file = g_file_new_for_path (icon_info->filename);
+ icon_info->is_svg = suffix == ICON_SUFFIX_SVG;
g_free (file);
}
else
@@ -3467,6 +3468,7 @@ icon_info_new (IconThemeDirType type, int dir_size, int dir_scale)
icon_info->dir_size = dir_size;
icon_info->dir_scale = dir_scale;
icon_info->unscaled_scale = 1.0;
+ icon_info->is_svg = FALSE;
return icon_info;
}
@@ -5412,6 +5414,7 @@ gtk_icon_theme_lookup_by_gicon_for_scale (GtkIconTheme *icon_theme,
{
info = icon_info_new (ICON_THEME_DIR_UNTHEMED, size, 1);
info->loadable = G_LOADABLE_ICON (g_object_ref (icon));
+ info->is_svg = FALSE;
if (G_IS_FILE_ICON (icon))
{
@@ -5420,6 +5423,7 @@ gtk_icon_theme_lookup_by_gicon_for_scale (GtkIconTheme *icon_theme,
{
info->icon_file = g_object_ref (file);
info->filename = g_file_get_path (file);
+ info->is_svg = suffix_from_name (info->filename) == ICON_SUFFIX_SVG;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]