diff options
author | Ted Gould <ted@gould.cx> | 2011-03-21 11:57:17 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-03-21 11:57:17 -0500 |
commit | f297caeae1f563fe023cfd57cd7b3d05d8d32d47 (patch) | |
tree | 83341a9d89cfdfd43f98eb1500bc2d3185288deb /libdbusmenu-glib | |
parent | b0889bb2cb63e1dd08b87e3c45a1e12fb237a6c2 (diff) | |
download | libdbusmenu-f297caeae1f563fe023cfd57cd7b3d05d8d32d47.tar.gz libdbusmenu-f297caeae1f563fe023cfd57cd7b3d05d8d32d47.tar.bz2 libdbusmenu-f297caeae1f563fe023cfd57cd7b3d05d8d32d47.zip |
A couple more intr_loops with a small memory leak fix
Diffstat (limited to 'libdbusmenu-glib')
-rw-r--r-- | libdbusmenu-glib/client.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index ff74bbf..20b91f1 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1280,15 +1280,20 @@ menuproxy_signal_cb (GDBusProxy * proxy, gchar * sender, gchar * signal, GVarian gchar * property; GVariant * value; - while (g_variant_iter_next(&properties, "{sv}", &property, &value)) { + while (g_variant_iter_loop(&properties, "{sv}", &property, &value)) { GVariant * internalvalue = value; if (G_LIKELY(g_variant_is_of_type(value, G_VARIANT_TYPE_VARIANT))) { /* Unboxing if needed */ internalvalue = g_variant_get_variant(value); - g_variant_unref(value); } + id_prop_update(proxy, id, property, internalvalue, client); - g_variant_unref(internalvalue); + + if (internalvalue != value) { + /* If we unboxed, we need to drop it, otherwise the + iter_loop function will unref for us */ + g_variant_unref(internalvalue); + } } g_variant_unref(propv); g_variant_unref(item); @@ -1707,20 +1712,16 @@ parse_layout_xml(DbusmenuClient * client, GVariant * layout, DbusmenuMenuitem * all other properties. */ child_props = g_variant_get_child_value(child, 1); g_variant_iter_init(&iter, child_props); - while (g_variant_iter_next(&iter, "{sv}", &prop, &value)) { + while (g_variant_iter_loop(&iter, "{sv}", &prop, &value)) { if (g_strcmp0(prop, DBUSMENU_MENUITEM_PROP_TYPE) == 0) { dbusmenu_menuitem_property_set_variant(childmi, prop, value); } - g_free(prop); - g_variant_unref(value); } /* Now go through and do all the properties. */ g_variant_iter_init(&iter, child_props); - while (g_variant_iter_next(&iter, "{sv}", &prop, &value)) { + while (g_variant_iter_loop(&iter, "{sv}", &prop, &value)) { dbusmenu_menuitem_property_set_variant(childmi, prop, value); - g_free(prop); - g_variant_unref(value); } g_variant_unref(child_props); } |