gtkicontheme: More explicitly note ownership transfers of duplicated string

I was hunting a memory leak and couldn't find it; at least I'm
pretty sure all of these are OK.  But document things better
for the future.

Also use g_hash_table_replace in one more case for consistency.

https://bugzilla.gnome.org/show_bug.cgi?id=649457
This commit is contained in:
Colin Walters 2011-05-05 10:13:13 -04:00
parent dced75dcc4
commit 703af0fb48

View File

@ -1215,9 +1215,10 @@ load_themes (GtkIconTheme *icon_theme)
else
unthemed_icon->no_svg_filename = abs_file;
g_hash_table_insert (priv->unthemed_icons,
base_name,
unthemed_icon);
/* takes ownership of base_name */
g_hash_table_replace (priv->unthemed_icons,
base_name,
unthemed_icon);
g_hash_table_insert (priv->all_icons,
base_name, NULL);
}
@ -2412,6 +2413,7 @@ load_icon_data (IconThemeDir *dir, const char *path, const char *name)
base_name = strip_suffix (name);
data = g_slice_new0 (GtkIconData);
/* takes ownership of base_name */
g_hash_table_replace (dir->icon_data, base_name, data);
ivalues = g_key_file_get_integer_list (icon_file,
@ -2510,6 +2512,7 @@ scan_directory (GtkIconThemePrivate *icon_theme,
hash_suffix = GPOINTER_TO_INT (g_hash_table_lookup (dir->icons, base_name));
g_hash_table_replace (icon_theme->all_icons, base_name, NULL);
/* takes ownership of base_name */
g_hash_table_replace (dir->icons, base_name, GUINT_TO_POINTER (hash_suffix| suffix));
}