RE: [sigc] derive from sigc::trackable directly?



> 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?




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]