[Bug 39189] [API Break] Use GPtrArray as our preferred container for collections

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Wed Feb 22 20:32:01 CET 2012


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

Simon McVittie <simon.mcvittie at collabora.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |31668

--- Comment #1 from Simon McVittie <simon.mcvittie at collabora.co.uk> 2012-02-22 11:32:01 PST ---
I'm a bit concerned about diverging from what GIO is establishing as the
convention. In GIO, these return a (transfer full) GList:

g_app_info_get_all
g_content_types_get_registered
g_dbus_object_get_interfaces
g_dbus_object_manager_get_objects
g_drive_get_volumes
g_file_enumerator_next_files_finish
g_io_modules_load_all_in_directory
g_resolver_lookup_by_name
g_resolver_lookup_by_name_finish
g_resolver_lookup_service
g_resolver_lookup_service_finish
g_tls_certificate_list_new_from_file
g_tls_client_connection_get_accepted_cas
g_tls_database_lookup_certificates_issued_by
g_tls_database_lookup_certificates_issued_by_finish
g_unix_mount_points_get
g_unix_mounts_get
g_volume_monitor_get_connected_drives
g_volume_monitor_get_volumes

and these return a (transfer none) GList (which might be considered a bug,
seeing how overwhelmingly (transfer full) the rest of GIO is):

g_emblemed_icon_get_emblems
g_io_extension_point_get_extensions

This also makes our current use of (transfer container) in, for instance,
tp_account_manager_get_valid_accounts() look like an API wart; maybe we should
change them all to (transfer full) for 1.0?

I'm also not sure how you annotate a GPtrArray that has a free-function set. I
think it's probably (transfer container), since the caller only needs to free
the array? But I could be wrong...

GPtrArray has the advantage that you can ref it easily, and the disadvantage
that if a caller mutates the returned GPtrArray and it was a ref to one kept
internally by our object, "it changes for everyone"; similarly, if our object
updates its internal cache in response to D-Bus signals, anyone still holding a
ref may find that their copy has changed.

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