ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #03231
[Merge] lp:~chrisccoulson/dbusmenu/theme_changed_cb_disconnect into lp:dbusmenu
Chris Coulson has proposed merging lp:~chrisccoulson/dbusmenu/theme_changed_cb_disconnect into lp:dbusmenu.
Requested reviews:
Ted Gould (ted)
For more details, see:
https://code.launchpad.net/~chrisccoulson/dbusmenu/theme_changed_cb_disconnect/+merge/51596
Ensure we disconnect theme_changed_cb if the DbusmenuMenuitem disappears, but the corresponding GtkMenuItem stays alive. This shouldn't really be a problem, as dbusmenu_item_freed *should* do enough cleaning up to ensure that theme_changed_cb is inert if it fires later on. Just do this to be safe though
--
https://code.launchpad.net/~chrisccoulson/dbusmenu/theme_changed_cb_disconnect/+merge/51596
Your team ayatana-commits is subscribed to branch lp:dbusmenu.
=== modified file 'libdbusmenu-gtk/parser.c'
--- libdbusmenu-gtk/parser.c 2011-02-24 17:23:47 +0000
+++ libdbusmenu-gtk/parser.c 2011-02-28 18:49:50 +0000
@@ -149,6 +149,14 @@
return;
}
+static void
+widget_freed (gpointer data, GObject * obj)
+{
+ g_signal_handlers_disconnect_by_func(gtk_icon_theme_get_default(), G_CALLBACK(theme_changed_cb), obj);
+
+ return;
+}
+
/* Called when the dbusmenu item that we're keeping around
is finalized */
static void
@@ -157,18 +165,12 @@
ParserData *pdata = (ParserData *)g_object_get_data(G_OBJECT(obj), PARSER_DATA);
if (pdata != NULL && pdata->widget != NULL) {
+ g_signal_handlers_disconnect_by_func(gtk_icon_theme_get_default(), G_CALLBACK(theme_changed_cb), pdata->widget);
g_object_steal_data(G_OBJECT(pdata->widget), CACHED_MENUITEM);
+ g_object_weak_unref(G_OBJECT(pdata->widget), widget_freed, NULL);
}
}
-static void
-widget_freed (gpointer data, GObject * obj)
-{
- g_signal_handlers_disconnect_by_func(gtk_icon_theme_get_default(), G_CALLBACK(theme_changed_cb), obj);
-
- return;
-}
-
/* Gets the positon of the child with its' parent if it has one.
Returns -1 if the position is unable to be calculated. */
static gint
Follow ups