[Interest] Automatic deletion of children of QObject
Jochen Becher
jochen_becher at gmx.de
Wed Jun 13 22:50:12 CEST 2012
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 at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
More information about the Interest
mailing list