diff options
author | Chris Coulson <chrisccoulson@ubuntu.com> | 2011-02-28 18:29:17 +0000 |
---|---|---|
committer | Chris Coulson <chrisccoulson@ubuntu.com> | 2011-02-28 18:29:17 +0000 |
commit | b8c5def4dd43b7061a65ba87f65b4b578a9d5c35 (patch) | |
tree | 2eb36c6bd72d17d7c0534d378cf7da7da919e66b /libdbusmenu-gtk | |
parent | 218b2b32a73881b198f09f74725d395d2d27acdc (diff) | |
download | libdbusmenu-b8c5def4dd43b7061a65ba87f65b4b578a9d5c35.tar.gz libdbusmenu-b8c5def4dd43b7061a65ba87f65b4b578a9d5c35.tar.bz2 libdbusmenu-b8c5def4dd43b7061a65ba87f65b4b578a9d5c35.zip |
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
Diffstat (limited to 'libdbusmenu-gtk')
-rw-r--r-- | libdbusmenu-gtk/parser.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/libdbusmenu-gtk/parser.c b/libdbusmenu-gtk/parser.c index 97f7979..30c802f 100644 --- a/libdbusmenu-gtk/parser.c +++ b/libdbusmenu-gtk/parser.c @@ -149,6 +149,14 @@ parse_data_free (gpointer data) 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 @@ dbusmenu_item_freed (gpointer data, GObject * obj) 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 |