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 600751 - GCompletion should better document if and how items memory is managed
GCompletion should better document if and how items memory is managed
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: docs
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2009-11-04 23:03 UTC by Colomban Wendling
Modified: 2012-08-17 06:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
add some explanation of memory management (2.60 KB, patch)
2012-02-17 11:56 UTC, David King
committed Details | Review

Description Colomban Wendling 2009-11-04 23:03:49 UTC
The documentation of GCompletion misses to explain what is done, and therefore what to do, with the memory of inserted items.

For example, should the list given to g_completion_add_items() or g_completion_remove_items() be freed by the caller? And its elements' data?

Do g_completion_remove_items() and g_completion_clear_items() release the memory allocated for the elements they frees? If not, how to free this memory (e.g. how to know which elements are not needed any more?). Do g_completion_free() release item's memory?

I think all theses points must be made clear.
Comment 1 David King 2012-02-17 11:56:12 UTC
Created attachment 207847 [details] [review]
add some explanation of memory management

GCompletion is now deprecated, and bookkeeping of the completion items was one reason for this:

http://mail.gnome.org/archives/gtk-devel-list/2010-June/msg00193.html

Nevertheless, GObject Introspection annotations give some hints, and the attached patch should be sufficient to cover the things that you requested.
Comment 2 Matthias Clasen 2012-08-16 22:47:41 UTC
Review of attachment 207847 [details] [review]:

Sure, looks fine. If you want to push that, go ahead.
Comment 3 David King 2012-08-17 06:17:53 UTC
Comment on attachment 207847 [details] [review]
add some explanation of memory management

Thanks, pushed to master as commit 86a4fd6fa98de29f7ee05ba655a00e4c42f11756.