> Fix the double-deletes instead - those are real issues! If an object is
> double-deleted it might be an indication that it should not have been
> allocated on the stack in the first place...
>

This was what I wanted to underline, maybe not clear from my side...
Allocating on the stack an object that has some destruction mechanisms
elsewhere is not a good idea IMHO, so I never allocate any QObject on
stack. And this is not only for objects with parent : any connection to
deleteLater() or flags such as WA_DeleteOnClose allows the object to be
deleted, and this may be invisible in the main(). For instance, if main()
and QMainWidget are written by different developers.

One of the most reliable Qt way of deleting QObjects remains (again IMHO):
connect(currentThread(), SIGNAL(finished()), object, SLOT(deleteLater()));

Because it cannot double delete and does not even require storing a
pointer. And will always delete unless the app crashes.

I've never used it on the main widget, though, but there is no reason it
should'nt work
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to