diff options
author | Xavier Claessens <xavier.claessens@collabora.co.uk> | 2012-04-16 17:42:33 +0200 |
---|---|---|
committer | Xavier Claessens <xavier.claessens@collabora.co.uk> | 2012-04-16 18:43:25 +0200 |
commit | a75257708a4766a5e1fcbf19d1d7d5bf588eab91 (patch) | |
tree | 73498a0eea718085a489e005540041ad081dd11d /telepathy-glib/call-channel.c | |
parent | 9fee4385e567e0f4265ffdddb6898aa0d364214e (diff) | |
download | telepathy-glib-a75257708a4766a5e1fcbf19d1d7d5bf588eab91.tar.gz |
Do not use _tp_connection_lookup_contact() outside contact.c
That function is dangerous because it does not guarantee that the returned TpContact
has an identifier set.
In the case a TpContact is being created with tp_connection_get_contacts_by_id(),
the first step is to inspect its handle and then create the TpContact object
*without* giving its ID. The id will be set later once we got the contact attributes.
If _tp_connection_lookup_contact() is called for the same handle/id between
the moment the TpContact is created and the moment it sets its attributes, then
a contact with no identifier is returned.
Diffstat (limited to 'telepathy-glib/call-channel.c')
-rw-r--r-- | telepathy-glib/call-channel.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/telepathy-glib/call-channel.c b/telepathy-glib/call-channel.c index 4404aaad7..cdd619d1a 100644 --- a/telepathy-glib/call-channel.c +++ b/telepathy-glib/call-channel.c @@ -77,7 +77,7 @@ struct _TpCallChannelPrivate GHashTable *state_details; TpCallStateReason *state_reason; gboolean hardware_streaming; - /* TpHandle -> TpCallMemberFlags */ + /* TpContact -> TpCallMemberFlags */ GHashTable *members; gboolean initial_audio; gboolean initial_video; @@ -270,14 +270,15 @@ _tp_call_members_convert_array (TpConnection *connection, TpContact *contact; /* The contact is supposed to already exists */ - contact = _tp_connection_lookup_contact (connection, handle); + contact = tp_connection_dup_contact_if_possible (connection, + handle, NULL); if (contact == NULL) { DEBUG ("No TpContact found for handle %u", handle); continue; } - g_ptr_array_add (result, g_object_ref (contact)); + g_ptr_array_add (result, contact); } return result; |