← Back to team overview

ayatana-commits team mailing list archive

[Branch ~dbusmenu-team/dbusmenu/trunk] Rev 247: Disconnecting theme changed on normal cleanup as well to ensure it's benign.

 

Merge authors:
  Chris Coulson (chrisccoulson)
Related merge proposals:
  https://code.launchpad.net/~chrisccoulson/dbusmenu/theme_changed_cb_disconnect/+merge/51596
  proposed by: Chris Coulson (chrisccoulson)
  review: Approve - Ted Gould (ted)
------------------------------------------------------------
revno: 247 [merge]
committer: Ted Gould <ted@xxxxxxxx>
branch nick: trunk
timestamp: Tue 2011-03-01 11:41:58 -0600
message:
  Disconnecting theme changed on normal cleanup as well to ensure it's benign.
modified:
  libdbusmenu-gtk/parser.c


--
lp:dbusmenu
https://code.launchpad.net/~dbusmenu-team/dbusmenu/trunk

Your team ayatana-commits is subscribed to branch lp:dbusmenu.
To unsubscribe from this branch go to https://code.launchpad.net/~dbusmenu-team/dbusmenu/trunk/+edit-subscription
=== modified file 'libdbusmenu-gtk/parser.c'
--- libdbusmenu-gtk/parser.c	2011-03-01 17:24:25 +0000
+++ libdbusmenu-gtk/parser.c	2011-03-01 17:41:58 +0000
@@ -155,6 +155,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
@@ -163,18 +171,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