From e92fb8d011ef38491a724b828bb83b1a63a810cb Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 9 Feb 2010 23:34:06 -0600 Subject: Killing our children --- libdbusmenu-glib/menuitem-proxy.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'libdbusmenu-glib/menuitem-proxy.c') diff --git a/libdbusmenu-glib/menuitem-proxy.c b/libdbusmenu-glib/menuitem-proxy.c index 0bbfd26..78244d3 100644 --- a/libdbusmenu-glib/menuitem-proxy.c +++ b/libdbusmenu-glib/menuitem-proxy.c @@ -207,6 +207,13 @@ proxy_item_child_moved (DbusmenuMenuitem * parent, DbusmenuMenuitem * child, gui return; } +/* Making g_object_unref into a GFunc */ +static void +func_g_object_unref (gpointer data, gpointer user_data) +{ + return g_object_unref(G_OBJECT(data)); +} + /* References all of the things we need for talking to this menuitem including signals and other data. If the menuitem already has properties we need to signal that they've changed for us. */ @@ -270,6 +277,9 @@ remove_menuitem (DbusmenuMenuitemProxy * pmi) priv->mi = NULL; /* Remove our own children */ + GList * children = dbusmenu_menuitem_take_children(DBUSMENU_MENUITEM(pmi)); + g_list_foreach(children, func_g_object_unref, NULL); + g_list_free(children); return; } -- cgit v1.2.3