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:
@ -1215,7 +1215,8 @@ load_themes (GtkIconTheme *icon_theme)
|
|||||||
else
|
else
|
||||||
unthemed_icon->no_svg_filename = abs_file;
|
unthemed_icon->no_svg_filename = abs_file;
|
||||||
|
|
||||||
g_hash_table_insert (priv->unthemed_icons,
|
/* takes ownership of base_name */
|
||||||
|
g_hash_table_replace (priv->unthemed_icons,
|
||||||
base_name,
|
base_name,
|
||||||
unthemed_icon);
|
unthemed_icon);
|
||||||
g_hash_table_insert (priv->all_icons,
|
g_hash_table_insert (priv->all_icons,
|
||||||
@ -2412,6 +2413,7 @@ load_icon_data (IconThemeDir *dir, const char *path, const char *name)
|
|||||||
base_name = strip_suffix (name);
|
base_name = strip_suffix (name);
|
||||||
|
|
||||||
data = g_slice_new0 (GtkIconData);
|
data = g_slice_new0 (GtkIconData);
|
||||||
|
/* takes ownership of base_name */
|
||||||
g_hash_table_replace (dir->icon_data, base_name, data);
|
g_hash_table_replace (dir->icon_data, base_name, data);
|
||||||
|
|
||||||
ivalues = g_key_file_get_integer_list (icon_file,
|
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));
|
hash_suffix = GPOINTER_TO_INT (g_hash_table_lookup (dir->icons, base_name));
|
||||||
g_hash_table_replace (icon_theme->all_icons, base_name, NULL);
|
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));
|
g_hash_table_replace (dir->icons, base_name, GUINT_TO_POINTER (hash_suffix| suffix));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user