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 675472 - GLib.Variant instances aren't unreferenced
GLib.Variant instances aren't unreferenced
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: gobject
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2012-05-04 20:53 UTC by Michal Hruby
Modified: 2012-05-14 11:09 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Michal Hruby 2012-05-04 20:53:04 UTC
Creating a new GLib.Variant instance and removing it afterwards doesn't unreference the instance.

Since Variant is wrapped in a python wrapper, simply adding a __del__ method that calls self.unref() seems to fix the issue.
Comment 1 Martin Pitt 2012-05-05 07:29:38 UTC
The refcount of a GVariant object is unfortunately not accessible, so it's hard to write a test for this. I verified that all tests still work with a single unref(), and that they fail with

(runtests.py:14248): GLib-CRITICAL **: g_variant_unref: assertion `value->ref_count > 0' failed


when trying to unref() twice.

Fixed in master now. Thanks for pointing this out!
Comment 2 Johan (not receiving bugmail) Dahlin 2012-05-06 17:15:08 UTC
I think this bug is wrong, implementing __del__ used to mean that an object is never garbage collected properly on the python side.
Comment 3 Martin Pitt 2012-05-14 11:09:40 UTC
Johan, I'm afraid I don't understand what you mean. It does seem to work, does it not for you?