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 624249 - GLib.List.remove() leaks references
GLib.List.remove() leaks references
Status: RESOLVED DUPLICATE of bug 586577
Product: vala
Classification: Core
Component: Bindings: GLib
0.9.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2010-07-13 13:24 UTC by Philip Withnall
Modified: 2010-08-04 08:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GLib.List.remove() reference leak test case (354 bytes, text/plain)
2010-07-13 13:24 UTC, Philip Withnall
  Details
glib-2.0: add some helper for List remove (1.59 KB, patch)
2010-07-21 20:13 UTC, Marc-Andre Lureau
none Details | Review

Description Philip Withnall 2010-07-13 13:24:14 UTC
Created attachment 165798 [details]
GLib.List.remove() reference leak test case

Test case attached. GLib.List.prepend() adds a reference to the object I add to the list, but GLib.List.remove() doesn't do a corresponding unref.
Comment 1 Philip Withnall 2010-07-13 13:25:24 UTC
When run, the Foobar instance never gets destroyed:

[philip@philip-laptop Desktop]$ ./test
** Message: test.vala:7: Creating a Foobar: 0x9ef7000
[philip@philip-laptop Desktop]$
Comment 2 Marc-Andre Lureau 2010-07-21 20:13:00 UTC
unfortunately, GList cannot be managed properly.

You have basically two options:
- use Gee (recommended)
- do things the dirty way, and that means you need to know what you are doing

I propose a patch to add some helpers, for discussion. It shouldn't hurt, so perhaps it could be added to glib-2.0 bindings.
Comment 3 Marc-Andre Lureau 2010-07-21 20:13:25 UTC
Created attachment 166328 [details] [review]
glib-2.0: add some helper for List remove
Comment 4 Evan Nemerson 2010-08-04 07:32:40 UTC
Anyone see a reason this shouldn't be marked as a duplicate of bug #586577?
Comment 5 Philip Withnall 2010-08-04 08:05:44 UTC
Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find.

*** This bug has been marked as a duplicate of bug 586577 ***