aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-glib
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-03-21 11:46:34 -0500
committerTed Gould <ted@gould.cx>2011-03-21 11:46:34 -0500
commitef9ec99c8deea6464debc0f46db35a943143ba79 (patch)
tree4c8b675e994e956909b60b97a2720d1983383737 /libdbusmenu-glib
parent746a792ef912c5160fed15bf817df5124f6610b0 (diff)
downloadlibdbusmenu-ef9ec99c8deea6464debc0f46db35a943143ba79.tar.gz
libdbusmenu-ef9ec99c8deea6464debc0f46db35a943143ba79.tar.bz2
libdbusmenu-ef9ec99c8deea6464debc0f46db35a943143ba79.zip
Use iter_loop to handle unref'ing the variants cleanly.
Diffstat (limited to 'libdbusmenu-glib')
-rw-r--r--libdbusmenu-glib/client.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c
index 2976436..5aae810 100644
--- a/libdbusmenu-glib/client.c
+++ b/libdbusmenu-glib/client.c
@@ -1336,19 +1336,16 @@ menuitem_get_properties_cb (GVariant * properties, GError * error, gpointer data
return;
}
- GVariantIter * iter = g_variant_iter_new(properties);
+ GVariantIter iter;
gchar * key;
GVariant * value;
- while (g_variant_iter_next(iter, "{sv}", &key, &value)) {
- dbusmenu_menuitem_property_set_variant(item, key, value);
+ g_variant_iter_init(&iter, properties);
- g_variant_unref(value);
- g_free(key);
+ while (g_variant_iter_loop(&iter, "{sv}", &key, &value)) {
+ dbusmenu_menuitem_property_set_variant(item, key, value);
}
- g_variant_iter_free(iter);
-
g_object_unref(data);
return;