diff options
author | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2012-04-05 12:52:25 -0400 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2012-11-16 10:08:44 +0000 |
commit | 077a77aee8fc3bde292f60786059b27cc03e7428 (patch) | |
tree | a381faa3bd0b610a64b102823313890e92c9d890 | |
parent | 58a36c1de45657a0c3da327ffd90885694623e80 (diff) |
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@collabora.co.uk>
-rw-r--r-- | 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 ec472034..8aeac5b4 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); |