Re: Connecting signal to destruction of an object - or - self-destructing handlers
- From: Murray Cumming <murrayc murrayc com>
- To: Daniel Boles <dboles src gmail com>, gtkmm-list <gtkmm-list gnome org>
- Subject: Re: Connecting signal to destruction of an object - or - self-destructing handlers
- Date: Wed, 05 Jul 2017 13:49:12 +0200
On Tue, 2017-07-04 at 09:44 +0100, Daniel Boles wrote:
How/can I receive an event when some object of my choice is
destroyed, so that I can take appropriate action?
Here's an example I came up against lately. I should probably
refactor the code so I don't need to do things this way... but it
illustrates the question quite well. I have a ComboBox where, via
some boring exposition, I want to put a signal_changed() handler on
its StyleContext. However, that handler holds a reference to a row in
the ComboBox's model. Therefore, I need to receive notification when
that model dies (i.e. when all holders of RefPtrs release them), so
that I can disconnect that signal_changed() handler and therefore
stop it from trying to access a dead row.
[snip]
This shouldn't generally happen. The sigc::trackable base class should
take care of this. Maybe it would be best to try to reduce this to a
simple test case.
--
Murray Cumming
murrayc murrayc com
www.murrayc.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]