telepathy-salut: contact-manager: safely return if called after having cleaned up
Will Thompson
wjt at kemper.freedesktop.org
Fri Nov 16 08:17:23 PST 2012
Module: telepathy-salut
Branch: master
Commit: 077a77aee8fc3bde292f60786059b27cc03e7428
URL: http://cgit.freedesktop.org/telepathy/telepathy-salut/commit/?id=077a77aee8fc3bde292f60786059b27cc03e7428
Author: Jonny Lamb <jonny.lamb at collabora.co.uk>
Date: Thu Apr 5 12:52:25 2012 -0400
contact-manager: safely return if called after having cleaned up
The OLPC activity manager's removed-service callback was looking up a
contact after the contact manager had cleaned up (but not disposed)
which was causing an assertion. The activity manager should arguably
disconnect from said signals...
Signed-off-by: Jonny Lamb <jonny.lamb at collabora.co.uk>
---
src/contact-manager.c | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/contact-manager.c b/src/contact-manager.c
index ec47203..8aeac5b 100644
--- a/src/contact-manager.c
+++ b/src/contact-manager.c
@@ -397,16 +397,20 @@ salut_contact_manager_start (SalutContactManager *self,
SalutContact *
salut_contact_manager_get_contact (SalutContactManager *mgr, TpHandle handle)
{
- TpHandleRepoIface *handle_repo = tp_base_connection_get_handles (
- TP_BASE_CONNECTION (mgr->connection), TP_HANDLE_TYPE_CONTACT);
- const char *name = tp_handle_inspect (handle_repo, handle);
+ TpHandleRepoIface *handle_repo;
+ const char *name;
SalutContact *ret;
- g_return_val_if_fail (name, NULL);
-
- if (mgr->contacts == NULL)
+ /* have we already closed everything? */
+ if (mgr->connection == NULL || mgr->contacts == NULL)
return NULL;
+ handle_repo = tp_base_connection_get_handles (
+ TP_BASE_CONNECTION (mgr->connection), TP_HANDLE_TYPE_CONTACT);
+ name = tp_handle_inspect (handle_repo, handle);
+
+ g_return_val_if_fail (name, NULL);
+
DEBUG ("Getting contact for: %s", name);
ret = g_hash_table_lookup (mgr->contacts, name);
More information about the telepathy-commits
mailing list