Of course it is not a bad idea to access siblings in a destructor. Why
should it? If destruction follows in a known and reliable way there is
no reason to avoid it. I do it to check some post-conditions using
Q_ASSERT() to ensure all resources were freed and that involves some
checks in siblings.

I wouldn't name another developer's solution a bad idea without knowing
why the solution was chosen...

Regards, Jochen


Am Dienstag, den 12.06.2012, 23:14 +0200 schrieb Thiago Macieira:
> On terça-feira, 12 de junho de 2012 21.36.46, Jochen Becher wrote:
> > In my case childB is not a child of childA but both are children of
> > parent (widgets in the same group/layout). But childB has a reference to
> > childA which might be accessed in destructor.
> 
> That's a whole different problem. Accessing siblings during destruction is a 
> bad idea by itself.
> 
> There's only one thing worse than that: deleting a sibling.
> 
> _______________________________________________
> Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest


_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to