GNOME Bugzilla – Bug 630987
Delegates may create reference cycles
Last modified: 2010-10-16 11:51:37 UTC
Created attachment 171409 [details] Test case to reproduce the bug A GObject derived class will do a g_object_ref(self) in it's constructor if you assign a lambda or non-static instance method to a delegate member of the class. This causes the constructor to return an object with refcount > 1. See attachment for a test case that asserts because of the described leaks. It exercises three cases: 0) Static methods (no leak) 1) Lambda (leak) 2) Instance methods (leak)
This is not a reference leak and it's also not an issue per se if a constructor returns an object with a reference count > 1. The real and more general issue is that it's very easy to create reference cycles when using delegates without an obvious way to avoid them.
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 624624 ***