aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-glib/menuitem.c
diff options
context:
space:
mode:
authorKen VanDine <ken.vandine@canonical.com>2011-01-27 16:40:56 -0500
committerKen VanDine <ken.vandine@canonical.com>2011-01-27 16:40:56 -0500
commite08b0e33060a39b3c95e43531825a95f5d415af8 (patch)
treecb3deecc01d16e57265afe76ce1074df10a79baa /libdbusmenu-glib/menuitem.c
parent4ef0a2886c4d4865a453ee32656937eb37669421 (diff)
parentea3e23cd918f2b8c7b6f9a94b3d80499bc0ce550 (diff)
downloadlibdbusmenu-e08b0e33060a39b3c95e43531825a95f5d415af8.tar.gz
libdbusmenu-e08b0e33060a39b3c95e43531825a95f5d415af8.tar.bz2
libdbusmenu-e08b0e33060a39b3c95e43531825a95f5d415af8.zip
releasing version 0.3.94-0ubuntu1
Diffstat (limited to 'libdbusmenu-glib/menuitem.c')
-rw-r--r--libdbusmenu-glib/menuitem.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c
index 827d6c5..b40195c 100644
--- a/libdbusmenu-glib/menuitem.c
+++ b/libdbusmenu-glib/menuitem.c
@@ -1204,11 +1204,17 @@ dbusmenu_menuitem_properties_list (DbusmenuMenuitem * mi)
return g_hash_table_get_keys(priv->properties);
}
+/* Copy the keys and make references to the variants that are
+ in the new table. They'll be free'd and unref'd when the
+ Hashtable gets destroyed. */
static void
copy_helper (gpointer in_key, gpointer in_value, gpointer in_data)
{
GHashTable * table = (GHashTable *)in_data;
- g_hash_table_insert(table, in_key, in_value);
+ gchar * key = (gchar *)in_key;
+ GVariant * value = (GVariant *)in_value;
+ g_variant_ref(value);
+ g_hash_table_insert(table, g_strdup(key), value);
return;
}
@@ -1229,7 +1235,7 @@ copy_helper (gpointer in_key, gpointer in_value, gpointer in_data)
GHashTable *
dbusmenu_menuitem_properties_copy (DbusmenuMenuitem * mi)
{
- GHashTable * ret = g_hash_table_new(g_str_hash, g_str_equal);
+ GHashTable * ret = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, _g_variant_unref);
g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), ret);