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 786060 - Sequences documentation does not make it clear who takes ownership of returned pointers
Sequences documentation does not make it clear who takes ownership of returne...
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: docs
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2017-08-09 17:19 UTC by Robie Basak
Modified: 2017-08-10 15:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gsequence: Add introspection annotations to Return values (6.81 KB, patch)
2017-08-10 11:34 UTC, Philip Withnall
committed Details | Review

Description Robie Basak 2017-08-09 17:19:10 UTC
I could not figure out, from https://developer.gnome.org/glib/stable/glib-Sequences.html, whether the caller is supposed to do anything about freeing memory related to the pointers returned by g_sequence_lookup or not.

From #gtk+:

17:54 <rbasak> Do functions like g_sequence_lookup_iter require the pointers they returned to be freed? I don't see anything documented at https://developer.gnome.org/glib/stable/glib-Sequences.html, nor any free functions, but I don't see how state can be stored in any other way.
17:55 <rbasak> Is there some higher level documentation on memory management I'm missing here?

18:01 <@ebassi> rbasak: The API reference should make it clear whether or not the returned value ownership is transfered to the caller or not

18:01 <@ebassi> rbasak: If it doesn't, please: file a bug

18:03 <@ebassi> (In this specific case, the iterator is owned by the GSequence so you should not free it)

18:15 <rbasak> ebassi: OK. Thanks!
Comment 1 Philip Withnall 2017-08-10 11:34:54 UTC
Created attachment 357336 [details] [review]
gsequence: Add introspection annotations to Return values

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Comment 2 Emmanuele Bassi (:ebassi) 2017-08-10 15:17:44 UTC
Review of attachment 357336 [details] [review]:

Looks good.
Comment 3 Philip Withnall 2017-08-10 15:39:05 UTC
Attachment 357336 [details] pushed as fac7f2b - gsequence: Add introspection annotations to Return values