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

2014-01-10 Thread Frank Hemer
On Friday 10 January 2014 20:35:56 Jan Kundrát wrote: > The C++'s order of destruction is, in this case: > > 1) ~QtSoapHttpTransport(), which does more or less nothing. By the time it > returns, the object is no longer a QSHT (which is the reason why you must > not call virtual methods from destru

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

2014-01-10 Thread Jan Kundrát
The C++'s order of destruction is, in this case: 1) ~QtSoapHttpTransport(), which does more or less nothing. By the time it returns, the object is no longer a QSHT (which is the reason why you must not call virtual methods from destructors). 2) Any member variables are destroyed. In this case,

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

2014-01-10 Thread Giuseppe D'Angelo
On 10 January 2014 19:09, Frank Hemer wrote: > On Friday 10 January 2014 21:58:13 Constantin Makshin wrote: >> No, it won't. 'this' is just a pointer and copying it anywhere (except a >> free-memory-in-destructor kind of smartpointer, of course, but using these >> to store a pointer to the parent

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

2014-01-10 Thread Frank Hemer
On Friday 10 January 2014 21:58:13 Constantin Makshin wrote: > No, it won't. 'this' is just a pointer and copying it anywhere (except a > free-memory-in-destructor kind of smartpointer, of course, but using these > to store a pointer to the parent object is a weird idea anyway) doesn't > affect the

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

2014-01-10 Thread Constantin Makshin
No, it won't. 'this' is just a pointer and copying it anywhere (except a free-memory-in-destructor kind of smartpointer, of course, but using these to store a pointer to the parent object is a weird idea anyway) doesn't affect the object's lifetime in any way; neither does the object's destructor g

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

2014-01-10 Thread Frank Hemer
On Friday 10 January 2014 20:51:35 Constantin Makshin wrote: > Everything is OK unless QNetworkAccessManager's constructor (or anything > further in the call chain) tries to use that pointer for anything beyond > copying it somewhere else. What exactly is looking suspicious to you? When the transp

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

2014-01-10 Thread Thiago Macieira
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

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

2014-01-10 Thread Constantin Makshin
Everything is OK unless QNetworkAccessManager's constructor (or anything further in the call chain) tries to use that pointer for anything beyond copying it somewhere else. What exactly is looking suspicious to you? On Jan 10, 2014 5:32 PM, "Frank Hemer" wrote: > Hi, > > when looking at the code

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

2014-01-10 Thread Frank Hemer
Hi, when looking at the code of the qt solutions (from git), I realized following snippet: class QT_QTSOAP_EXPORT QtSoapHttpTransport : public QObject { ... private: QNetworkAccessManager networkMgr; ... }; QtSoapHttpTransport::QtSoapHttpTransport(QObject *parent) : QObject(parent