[Bug 47322] [next] GCancellables for all async calls
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Mon Mar 19 16:53:13 CET 2012
https://bugs.freedesktop.org/show_bug.cgi?id=47322
--- Comment #3 from Simon McVittie <simon.mcvittie at collabora.co.uk> 2012-03-19 08:53:13 PDT ---
(In reply to comment #0)
> In the old generated APIs, we had weak_objects [...]
> The solution is to use GCancellable
Is this the GIO policy? It'd be worth asking the designers of GIO before
enforcing this globally. I'm not sure that this is appropriate for things that
don't have a user-visible side-effect or can't actually be cancelled.
If you want to avoid dereferencing a dangling pointer to a freed object,
GCancellable isn't suitable anyway, as far as I can see, because functions
taking a cancellable are free to ignore it - it's best-effort cancellation, not
guaranteed cancellation.
However, you can get the same effect as weak_object by using a TpWeakObject as
your user-data, and a sequence like this:
TpThing *self = tp_weak_ref_dup_object (user_data);
if (self == NULL)
return;
g_assert (TP_IS_THING (self));
/* continue with the async callback */
--
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA Contact for the bug.
You are the assignee for the bug.
More information about the telepathy-bugs
mailing list