Re: [sigc] derive from sigc::trackable directly?
- From: "John K. Grant" <grant cyrf com>
- To: libsigc-list gnome org
- Cc:
- Subject: Re: [sigc] derive from sigc::trackable directly?
- Date: Wed, 28 Dec 2005 08:35:49 -0800
Hi,
This is might be my first post, I've enjoyed reading this list for a
while, but I'm a newbie, so bare with me.
Does a class actually *need* to derive from trackable? Can one
implement an auto-disconnect feature in one's Base class without using
trackable? I am working with an engine whose base class supports
signals/slots, but is also reference counted. The authors chose to use
multiple inheritance, deriving from trackable and a Referenced class. I
would like to help eliminate this multiple inheritance, so I was
wondering if it is necessary to derive from trackable.
Also, has this thread ended? What was the resulting recommended usage?
Thank you much, -John
Dick Eimers wrote:
When DerivedX derives from sigc::trackable as you show, the order is
the same (IIRC), but in this case it depends on the order, i.e.
struct X: base, sigc::trackable{..};
is not equivalent to
struct X: sigc::trackable, base{..};
You remember correctly and I should have paid more attention to this..
Auto-disconnecting is fundamentally flawed when achieved via this
baseclass. The problem is that if you derive from a class, there is a
time between ~derived() is called and when it is disconnected in
~trackable(). If in between a call to one of its slots is done, these
slots end in nirvana. I'd say the solution is to disconnect in the
most derived dtor manually.
This explanation sounds plausible except for the "[..] the solution is
to disconnect in the most derived dtor manually"-part. It heads for
auto-disconnecting being fundamentally flawed.
Is manually disconnecting considered to be the best practice and should
sigc::trackable be avoided and used only with flat-hierarchies?
_______________________________________________
libsigc-list mailing list
libsigc-list gnome org
http://mail.gnome.org/mailman/listinfo/libsigc-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]