Merge lp:~ted/libdbusmenu/mem-leaks into lp:libdbusmenu/0.5

Proposed by Ted Gould
Status: Merged
Merged at revision: 194
Proposed branch: lp:~ted/libdbusmenu/mem-leaks
Merge into: lp:libdbusmenu/0.5
Diff against target: 67 lines (+12/-3)
2 files modified
libdbusmenu-glib/client.c (+4/-1)
libdbusmenu-glib/menuitem.c (+8/-2)
To merge this branch: bzr merge lp:~ted/libdbusmenu/mem-leaks
Reviewer Review Type Date Requested Status
Mikkel Kamstrup Erlandsen (community) Approve
Review via email: mp+47083@code.launchpad.net

Description of the change

Taking the heart of a patch attached to bug 690668 by hyperair. It didn't apply, but I think I found parts that still were issues by using it as a guide.

To post a comment you must log in.
Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

 review approve

Looks good to me

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'libdbusmenu-glib/client.c'
--- libdbusmenu-glib/client.c 2011-01-19 14:55:37 +0000
+++ libdbusmenu-glib/client.c 2011-01-21 19:38:10 +0000
@@ -517,6 +517,7 @@
517 listener->callback(NULL, error, listener->user_data);517 listener->callback(NULL, error, listener->user_data);
518 }518 }
519 g_array_free(listeners, TRUE);519 g_array_free(listeners, TRUE);
520 g_error_free(error);
520 return;521 return;
521 }522 }
522523
@@ -1140,7 +1141,6 @@
1140 if (error != NULL) {1141 if (error != NULL) {
1141 g_warning("Error getting properties on a new menuitem: %s", error->message);1142 g_warning("Error getting properties on a new menuitem: %s", error->message);
1142 g_object_unref(propdata->item);1143 g_object_unref(propdata->item);
1143 g_free(data);
1144 return;1144 return;
1145 }1145 }
11461146
@@ -1277,6 +1277,8 @@
1277 g_warning("Unable to send about_to_show: %s", error->message);1277 g_warning("Unable to send about_to_show: %s", error->message);
1278 /* Note: we're just ensuring only the callback gets called */1278 /* Note: we're just ensuring only the callback gets called */
1279 need_update = FALSE;1279 need_update = FALSE;
1280 g_error_free(error);
1281 error = NULL;
1280 } else {1282 } else {
1281 g_variant_get(params, "(b)", &need_update);1283 g_variant_get(params, "(b)", &need_update);
1282 g_variant_unref(params);1284 g_variant_unref(params);
@@ -1553,6 +1555,7 @@
15531555
1554 if (error != NULL) {1556 if (error != NULL) {
1555 g_warning("Getting layout failed: %s", error->message);1557 g_warning("Getting layout failed: %s", error->message);
1558 g_error_free(error);
1556 return;1559 return;
1557 }1560 }
15581561
15591562
=== modified file 'libdbusmenu-glib/menuitem.c'
--- libdbusmenu-glib/menuitem.c 2011-01-07 05:25:02 +0000
+++ libdbusmenu-glib/menuitem.c 2011-01-21 19:38:10 +0000
@@ -1204,11 +1204,17 @@
1204 return g_hash_table_get_keys(priv->properties);1204 return g_hash_table_get_keys(priv->properties);
1205}1205}
12061206
1207/* Copy the keys and make references to the variants that are
1208 in the new table. They'll be free'd and unref'd when the
1209 Hashtable gets destroyed. */
1207static void1210static void
1208copy_helper (gpointer in_key, gpointer in_value, gpointer in_data)1211copy_helper (gpointer in_key, gpointer in_value, gpointer in_data)
1209{1212{
1210 GHashTable * table = (GHashTable *)in_data;1213 GHashTable * table = (GHashTable *)in_data;
1211 g_hash_table_insert(table, in_key, in_value);1214 gchar * key = (gchar *)in_key;
1215 GVariant * value = (GVariant *)in_value;
1216 g_variant_ref(value);
1217 g_hash_table_insert(table, g_strdup(key), value);
1212 return;1218 return;
1213}1219}
12141220
@@ -1229,7 +1235,7 @@
1229GHashTable *1235GHashTable *
1230dbusmenu_menuitem_properties_copy (DbusmenuMenuitem * mi)1236dbusmenu_menuitem_properties_copy (DbusmenuMenuitem * mi)
1231{1237{
1232 GHashTable * ret = g_hash_table_new(g_str_hash, g_str_equal);1238 GHashTable * ret = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, _g_variant_unref);
12331239
1234 g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), ret);1240 g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), ret);
12351241

Subscribers

People subscribed via source and target branches