From ae811044a107035a82cbba64951661494dd33e3a Mon Sep 17 00:00:00 2001 From: Elliot Fairweather Date: Fri, 26 Jun 2009 14:45:22 +0100 Subject: disconnnect from invalidated signal before unreferencing connections --- libempathy/empathy-contact-manager.c | 44 ++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 20 deletions(-) (limited to 'libempathy') diff --git a/libempathy/empathy-contact-manager.c b/libempathy/empathy-contact-manager.c index f415ec19f..412087ec0 100644 --- a/libempathy/empathy-contact-manager.c +++ b/libempathy/empathy-contact-manager.c @@ -86,26 +86,6 @@ contact_manager_groups_changed_cb (EmpathyTpContactList *list, contact, group, is_member); } -static void -contact_manager_disconnect_foreach (gpointer key, - gpointer value, - gpointer user_data) -{ - EmpathyTpContactList *list = value; - EmpathyContactManager *manager = user_data; - - /* Disconnect signals from the list */ - g_signal_handlers_disconnect_by_func (list, - contact_manager_members_changed_cb, - manager); - g_signal_handlers_disconnect_by_func (list, - contact_manager_pendings_changed_cb, - manager); - g_signal_handlers_disconnect_by_func (list, - contact_manager_groups_changed_cb, - manager); -} - static void contact_manager_invalidated_cb (TpProxy *connection, guint domain, @@ -127,6 +107,30 @@ contact_manager_invalidated_cb (TpProxy *connection, } } +static void +contact_manager_disconnect_foreach (gpointer key, + gpointer value, + gpointer user_data) +{ + TpConnection *connection = key; + EmpathyTpContactList *list = value; + EmpathyContactManager *manager = user_data; + + /* Disconnect signals from the list */ + g_signal_handlers_disconnect_by_func (list, + contact_manager_members_changed_cb, + manager); + g_signal_handlers_disconnect_by_func (list, + contact_manager_pendings_changed_cb, + manager); + g_signal_handlers_disconnect_by_func (list, + contact_manager_groups_changed_cb, + manager); + g_signal_handlers_disconnect_by_func (connection, + contact_manager_invalidated_cb, + manager); +} + static void contact_manager_new_connection_cb (EmpathyAccountManager *account_manager, TpConnection *connection, -- cgit v1.2.3 From 240b54dbfe75e1d24a7619cf22e2ffd3acbb6427 Mon Sep 17 00:00:00 2001 From: Elliot Fairweather Date: Fri, 26 Jun 2009 14:49:30 +0100 Subject: disconnect from invalidated signal before unreferencing connections --- libempathy/empathy-account-manager.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'libempathy') diff --git a/libempathy/empathy-account-manager.c b/libempathy/empathy-account-manager.c index dd0a72f59..ff9fd2525 100644 --- a/libempathy/empathy-account-manager.c +++ b/libempathy/empathy-account-manager.c @@ -504,6 +504,18 @@ empathy_account_manager_init (EmpathyAccountManager *manager) mc_accounts_list_free (mc_accounts); } +static void +account_manager_disconnect_foreach (gpointer key, + gpointer value, + gpointer user_data) +{ + TpConnection *connection = key; + EmpathyAccountManager *manager = user_data; + + g_signal_handlers_disconnect_by_func (connection, connection_invalidated_cb, + manager); +} + static void do_finalize (GObject *obj) { @@ -511,6 +523,8 @@ do_finalize (GObject *obj) EmpathyAccountManagerPriv *priv = GET_PRIV (manager); g_hash_table_unref (priv->accounts); + g_hash_table_foreach (priv->connections, account_manager_disconnect_foreach, + obj); g_hash_table_unref (priv->connections); G_OBJECT_CLASS (empathy_account_manager_parent_class)->finalize (obj); -- cgit v1.2.3