aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-gtk
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-10-12 14:13:14 -0500
committerTed Gould <ted@gould.cx>2011-10-12 14:13:14 -0500
commitc67c6491e2de27d08aa890c83777c0746757ad67 (patch)
treed94d57fcb935121adc0b6582e5a1ca5f0c9202d1 /libdbusmenu-gtk
parentf573dd2328ddb983a741dec107b88835d6718a52 (diff)
parenta7c13792e9e339480c763a42808baed77e13314b (diff)
downloadlibdbusmenu-c67c6491e2de27d08aa890c83777c0746757ad67.tar.gz
libdbusmenu-c67c6491e2de27d08aa890c83777c0746757ad67.tar.bz2
libdbusmenu-c67c6491e2de27d08aa890c83777c0746757ad67.zip
Make sure to finally unref the GTK menuitem
Diffstat (limited to 'libdbusmenu-gtk')
-rw-r--r--libdbusmenu-gtk/client.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c
index 1051f20..38b6a75 100644
--- a/libdbusmenu-gtk/client.c
+++ b/libdbusmenu-gtk/client.c
@@ -823,14 +823,22 @@ item_activate (DbusmenuClient * client, DbusmenuMenuitem * mi, guint timestamp,
return;
}
-#ifdef MASSIVEDEBUGGING
static void
-destroy_gmi (GtkMenuItem * gmi, DbusmenuMenuitem * mi)
+destroy_gmi (GtkMenuItem * gmi)
{
- g_debug("Destorying GTK Menuitem for %d", dbusmenu_menuitem_get_id(mi));
+#ifdef MASSIVEDEBUGGING
+ g_debug("Destroying GTK Menuitem %d", gmi);
+#endif
+
+ /* Call gtk_widget_destroy to remove from any containers and cleanup */
+ gtk_widget_destroy(GTK_WIDGET(gmi));
+
+ /* Now remove last ref that we are holding (due to g_object_ref_sink in
+ dbusmenu_gtkclient_newitem_base). This should finalize the object */
+ g_object_unref(G_OBJECT(gmi));
+
return;
}
-#endif
/**
* dbusmenu_gtkclient_newitem_base:
@@ -857,7 +865,7 @@ dbusmenu_gtkclient_newitem_base (DbusmenuGtkClient * client, DbusmenuMenuitem *
/* Attach these two */
g_object_ref_sink(G_OBJECT(gmi));
- g_object_set_data_full(G_OBJECT(item), data_menuitem, gmi, (GDestroyNotify)gtk_widget_destroy);
+ g_object_set_data_full(G_OBJECT(item), data_menuitem, gmi, (GDestroyNotify)destroy_gmi);
/* DbusmenuMenuitem signals */
g_signal_connect(G_OBJECT(item), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(menu_prop_change_cb), client);