Commit d1e5d719 authored by Michael Natterer's avatar Michael Natterer 😴

app: fix the test that an icon theme folder actually contains a theme

and don't leak the GFile if it doesn't.
parent b8a819c1
......@@ -101,20 +101,20 @@ icon_themes_init (Gimp *gimp)
g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY)
{
GFile *file;
GFile *hicolor;
GFile *index_theme;
file = g_file_enumerator_get_child (enumerator, info);
/* make sure there is a index.theme file */
index_theme = g_file_get_child (file, "index.theme");
/* make sure there is a hicolor/index.theme file */
hicolor = g_file_get_child (file, "hicolor");
index_theme = g_file_get_child (hicolor, "index.theme");
if (index_theme)
if (g_file_query_exists (index_theme, NULL))
{
const gchar *name;
gchar *basename;
g_object_unref (index_theme);
name = gimp_file_get_utf8_name (file);
basename = g_path_get_basename (name);
......@@ -122,8 +122,13 @@ icon_themes_init (Gimp *gimp)
g_print ("Adding icon theme '%s' (%s)\n",
basename, name);
g_hash_table_insert (icon_themes_hash, basename, file);
g_hash_table_insert (icon_themes_hash, basename,
g_object_ref (file));
}
g_object_unref (index_theme);
g_object_unref (hicolor);
g_object_unref (file);
}
g_object_unref (info);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment