[Bug 27676] ContactInfo high-level API

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Wed Jun 2 17:00:29 CEST 2010


https://bugs.freedesktop.org/show_bug.cgi?id=27676

--- Comment #19 from Simon McVittie <simon.mcvittie at collabora.co.uk> 2010-06-02 08:00:28 PDT ---
(In reply to comment #12)
> you do need RequestContactInfo with a long (1 hour?)
> timeout.

but:

+  tp_cli_connection_interface_contact_info_call_request_contact_info (
+      self->priv->connection, -1, self->priv->handle, contact_info_request_cb,

-1 means the default timeout, usually 25 seconds. Please either take a timeout
as an explicit parameter (re-interpreting -1 as an hour or something), or just
set a long hard-coded timeout.

> If the dialog is closed, you can cancel the TpProxyPendingCall to free
> up some memory

Using the TpContact as the weak_object as you've done is not actually useful,
because GSimpleAsyncResult refs the source object (to ensure that the callback
runs precisely once). This means the only way to cancel the call is with the
TpProxyPendingCall.

The intended cancellation semantics of GAsyncResult and TpProxyPendingCall are
not the same, unfortunately; a GAsyncResult async call always runs its callback
exactly once, but a TpProxy call does not run its callback if cancelled. I
think you'll need to make a context struct that contains both the
GSimpleAsyncResult and the TpProxyPendingCall (or NULL if it already
completed), and use that as the user_data for the async call and the
cancellation signal. Alternatively, you could attach the TpProxyPendingCall to
the GSimpleAsyncResult as qdata, perhaps?

Either way, you need to keep track of whether it's already finished, since it's
invalid (use-after-free!) to cancel a TpProxyPendingCall that has already been
cancelled or called its callback.

> So really the only optional is tp_contact_info_field_spec_new() so I kept
> public for API completness... but can easily be moved to connection-internal.h
> if you like.

I'd be inclined to follow the general principle of "if it doesn't have to be
public, don't make it public" for that one.

> Totally agree those are useful. But can we delay those API helpers and get the
> core merged first?

Sure, we can do that later.

> done. Note that we forgot that for tp_avatar_requirements_copy(). Is it too
> late?

No, we can generally make things "more const" without breaking API. Please do
that on a trivia branch and we can fast-track it in.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.



More information about the telepathy-bugs mailing list