After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 677233 - (transfer full) annotation not correct for g_closure_new_simple return value
(transfer full) annotation not correct for g_closure_new_simple return value
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: docs
2.33.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2012-05-31 22:36 UTC by Phil Clayton
Modified: 2017-10-06 10:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gclosure: Fix (transfer) annotations on GClosure constructors (1.98 KB, patch)
2017-10-05 14:21 UTC, Philip Withnall
committed Details | Review

Description Phil Clayton 2012-05-31 22:36:29 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).
Comment 1 Philip Withnall 2017-10-05 14:21:57 UTC
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>
Comment 2 Emmanuele Bassi (:ebassi) 2017-10-06 09:52:36 UTC
Review of attachment 360965 [details] [review]:

Comment 3 Philip Withnall 2017-10-06 10:18:49 UTC
Attachment 360965 [details] pushed as 9cbff9f - gclosure: Fix (transfer) annotations on GClosure constructors