diff options
author | Milian Wolff <mail@milianw.de> | 2014-02-06 17:30:55 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-06 20:17:10 +0100 |
commit | 6e7f54a014c43dcd6e32e8288415808623e306f4 (patch) | |
tree | 660a396149c93da25299ceb2e52d10f420e22d64 /src/websockets/qwebsocket.cpp | |
parent | 95655e87913556e69bdda4a9b3140da4602031e4 (diff) | |
download | qtwebsockets-6e7f54a014c43dcd6e32e8288415808623e306f4.tar.gz |
Do not access QObject API before its private data is initialized.
Inside the ctor of the private data, the QObject has not yet
been associated with the data. Thus, accessing it indirectly i.e.
to setup private signal/slot connections, will trigger crashes.
Now we delay accessing this API and call an init() function manually
in the parent QObject-inheriting class.
Change-Id: I2c3ce7335c54d42af6bce87de867ee0ef197efc6
Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
Diffstat (limited to 'src/websockets/qwebsocket.cpp')
-rw-r--r-- | src/websockets/qwebsocket.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/websockets/qwebsocket.cpp b/src/websockets/qwebsocket.cpp index 45394e3..6e60230 100644 --- a/src/websockets/qwebsocket.cpp +++ b/src/websockets/qwebsocket.cpp @@ -262,6 +262,8 @@ QWebSocket::QWebSocket(const QString &origin, QObject *parent) : QObject(*(new QWebSocketPrivate(origin, version, this)), parent) { + Q_D(QWebSocket); + d->init(); } /*! @@ -301,6 +303,8 @@ QWebSocket::QWebSocket(QTcpSocket *pTcpSocket, QWebSocketProtocol::Version version, QObject *parent) : QObject(*(new QWebSocketPrivate(pTcpSocket, version, this)), parent) { + Q_D(QWebSocket); + d->init(); } /*! |