[Vala] refcounting, signals and closures
- From: Michael Gratton <mike vee net>
- To: vala-list <vala-list gnome org>
- Subject: [Vala] refcounting, signals and closures
- Date: Thu, 11 Aug 2016 12:10:19 +1000
Hey all,
I'm trying to track down a memory leak in Geary. I have a custom
subclass of Gtk.ListBox, instances of which are frequently added and
removed from the UI. When it is removed, it is both explicitly
destroyed (widget.destroy()) and all variables containing references to
it are nulled out. Further, I checked its child rows and they are all
are successful removed, destroyed and finalised. Despite all this,
instances of this custom listbox are never finalised, so I have a
memory leak, and probably due to something holding a reference to the
instances still.
The only things I can find that could still be holding a reference are
registered signal handlers, both to instance methods, eg:
> this.row_activated.connect(on_row_activated);
And using closures/lambdas:
> this.size_allocate.connect(() => { check_mark_read(); });
These are never explicitly disconnected in an overridden version of
destroy(), since they should be disconnected when the object is
finalised, by the GObject finaliser.
So, to get to the point, would either of these these hold references to
`this` that prevent it from being finalised?
Ta!
//Mike
--
⊨ Michael Gratton, Percept Wrangler.
⚙ <http://mjog.vee.net/>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]