[Bug 39189] [next] decide on a policy for transfer, naming and containers

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Wed Apr 4 13:45:37 CEST 2012


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

--- Comment #7 from Simon McVittie <simon.mcvittie at collabora.co.uk> 2012-04-04 04:45:37 PDT ---
(In reply to comment #6)
> Just wanted to mention that borrow is pretty much what we expect from a get in
> GLib.

I don't think it's actually as clear-cut as that: even in core libraries like
GIO, "get" often means "copy" (usually means copy, in GIO's case). In
GLib/GObject it often means "don't copy", e.g. g_value_get_object(), except for
when it doesn't, e.g. g_object_get()). Gtk is particularly inconsistent about
what "get" means.

> I found that our very sporadic use of borrow is more confusing then
> helpful.

We should settle on a meaning for "get"; if it means "copy", only use "get" and
"borrow" (or would you prefer "peek", maybe?) in APIs, and if it means "don't
copy", only use "get" and "dup" in APIs.

Jonny seemed to agree that our standard in Telepathy 1.0 should mimic what most
of GIO does: get means transfer full, and the standard container is GList.

(In reply to comment #6)
> It's only in GStreamer that get is a transfer full

... and GIO, at least for containers (almost entirely consistently, Comment
#1).

> not taking a ref is generally not thread safe.

I think this is a compelling argument for our default being transfer full: if
we want to allow telepathy-glib to ever be thread-safe (even if it remains
non-thread-safe for now), we have to copy anything that could otherwise be
modified or destroyed concurrently with it being used.

-- 
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