[Interest] C'tor member initialisation with 'this'

Thiago Macieira thiago.macieira at intel.com
Fri Jan 10 18:04:12 CET 2014


On sexta-feira, 10 de janeiro de 2014 14:32:01, Frank Hemer wrote:
> QtSoapHttpTransport::QtSoapHttpTransport(QObject *parent)
>     : QObject(parent), networkMgr(this)
> {
>    ...
> }
> 
> Is there any reason why the QNetworkAccessManager needs to be initialized
> with  the 'this' reference?

Yes. If the QtSoapHttpTransport object is moved to another thread with 
moveToThread(), its child objects will be moved too.

> Seems like a wrong approach to me - maybe because it used to be a pointer
> at  some point in time?
> 
> I found this when analyzing some weird and not really reproducible stack 
> traces ...

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140110/8b56bc88/attachment.sig>


More information about the Interest mailing list