GNOME Bugzilla – Bug 675472
GLib.Variant instances aren't unreferenced
Last modified: 2012-05-14 11:09:40 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.
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!
I think this bug is wrong, implementing __del__ used to mean that an object is never garbage collected properly on the python side.
Johan, I'm afraid I don't understand what you mean. It does seem to work, does it not for you?