[Development] Opinions on QTBUG-71545

Thiago Macieira thiago.macieira at intel.com
Mon Nov 5 21:06:50 CET 2018


On Monday, 5 November 2018 11:57:44 PST Tomasz Siekierda wrote:
> On Mon, 5 Nov 2018 at 20:32, Konstantin Shegunov <kshegunov at gmail.com> 
wrote:
> > Hello,
> > Since we couldn't agree, I'd love to see some more opinions about this
> > one.[1]
> > 
> > Specifically:
> > 1) Is parenting to the application object a thing?
> 
> Never done it myself. But Q*Application is clearly marked as derived
> from QObject in the docs, so users can definitely expect it to behave
> the same as all other QObjects and clean up it's children properly.
> 
> > 1.a) ... and should it be allowed (i.e. accepting the proposed change)?
> > 1.b) .. if not allowed, should we put a warning in the documentation that
> > it is wrong and shouldn't be done at all, or at least that it's
> > discouraged.
> Either is OK I think, with preference for 1.a). Note: these are not
> mutually exclusive - we could have the patch integrated & a warning in
> the docs that this is not encouraged.

The problem is that most Qt API is only supported while QCoreApplication still 
exists (and GUI stuff while QGuiApplication exists; widgets while QApplication 
exists). By the time the QObject destructor destroys the children of any of 
those, the QCoreApplication object no longer exists, so you're out of support.

That's why my opinion in the bug report was that you shouldn't do it.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center






More information about the Development mailing list