aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-gtk
diff options
context:
space:
mode:
authorMichael Terry <michael.terry@canonical.com>2011-11-10 17:49:27 -0500
committerMichael Terry <michael.terry@canonical.com>2011-11-10 17:49:27 -0500
commit1b83b3b0758d29d94a1e404f551939ea1885ad76 (patch)
treee8861c540845ecab14ae7afb63eb23bbeba059db /libdbusmenu-gtk
parentda6a2dfa870a1925ebb98fb10286bcde62d2db11 (diff)
downloadlibdbusmenu-1b83b3b0758d29d94a1e404f551939ea1885ad76.tar.gz
libdbusmenu-1b83b3b0758d29d94a1e404f551939ea1885ad76.tar.bz2
libdbusmenu-1b83b3b0758d29d94a1e404f551939ea1885ad76.zip
make sure to cancel an idle callback when the object dies
Diffstat (limited to 'libdbusmenu-gtk')
-rw-r--r--libdbusmenu-gtk/client.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c
index 38b6a75..533764a 100644
--- a/libdbusmenu-gtk/client.c
+++ b/libdbusmenu-gtk/client.c
@@ -505,7 +505,6 @@ menu_item_stop_activating(DbusmenuMenuitem * mi)
guint id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(parent),
data_idle_close_id));
if (id > 0) {
- g_source_remove(id);
g_object_set_data(G_OBJECT(parent), data_idle_close_id,
GINT_TO_POINTER(0));
should_close = TRUE;
@@ -575,6 +574,14 @@ close_in_idle (DbusmenuMenuitem * mi)
}
static void
+cancel_idle_close_id (gpointer data)
+{
+ guint id = GPOINTER_TO_INT(data);
+ if (id > 0)
+ g_source_remove(id);
+}
+
+static void
submenu_notify_visible_cb (GtkWidget * menu, GParamSpec * pspec, DbusmenuMenuitem * mi)
{
if (gtk_widget_get_visible (menu)) {
@@ -591,8 +598,8 @@ submenu_notify_visible_cb (GtkWidget * menu, GParamSpec * pspec, DbusmenuMenuite
data_idle_close_id));
if (id == 0) {
id = g_idle_add((GSourceFunc)close_in_idle, mi);
- g_object_set_data(G_OBJECT(mi), data_idle_close_id,
- GINT_TO_POINTER(id));
+ g_object_set_data_full(G_OBJECT(mi), data_idle_close_id,
+ GINT_TO_POINTER(id), cancel_idle_close_id);
}
}
}