GNOME Bugzilla – Bug 677233
(transfer full) annotation not correct for g_closure_new_simple return value
Last modified: 2017-10-06 10:18:58 UTC
g_closure_new_simple has the annotation (transfer full) for the return value but returns a floating GClosure. Generally, functions returning floating objects/structs are annotated with (transfer none) so that the caller will perform a ref+sink. As it stands, with (transfer full), a caller would just assume the existing ref, but later on, as the floating flag is still set, a ref+sink could end up assuming ownership of the same reference. Note that g_cclosure_new_swap (defined in terms of g_closure_new_simple) probably needs (transfer none) for similar reasons, though this function is annotated with (skip).
Created attachment 360965 [details] [review] gclosure: Fix (transfer) annotations on GClosure constructors They return floating references. The convention established by GVariant is to annotate these as (transfer none) so that the caller does a ref+sink on them, rather than just a ref. Signed-off-by: Philip Withnall <withnall@endlessm.com>
Review of attachment 360965 [details] [review]:
Attachment 360965 [details] pushed as 9cbff9f - gclosure: Fix (transfer) annotations on GClosure constructors