summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2015-04-15 09:10:47 +0200
committerLiang Qi <liang.qi@theqtcompany.com>2015-04-15 09:10:47 +0200
commit0a9cbcf2894f4f9e621e0f5fb644d2b5e15ab2c7 (patch)
tree3281831d594bf04d87667b08c525bb4cc31921f2 /src
parent0fcfc33963a48dee74eb971decbf89f35c3240f0 (diff)
parent5b469aa3c4d6b9c68feb9cf92d03614077518894 (diff)
downloadqtwebsockets-0a9cbcf2894f4f9e621e0f5fb644d2b5e15ab2c7.tar.gz
Merge remote-tracking branch 'origin/5.4' into 5.5v5.5.0-beta1
Change-Id: I29f5a2acb7ba0313d9e2ac2c005a988d208b617e
Diffstat (limited to 'src')
-rw-r--r--src/websockets/qwebsocket_p.cpp11
-rw-r--r--src/websockets/qwebsocket_p.h2
2 files changed, 13 insertions, 0 deletions
diff --git a/src/websockets/qwebsocket_p.cpp b/src/websockets/qwebsocket_p.cpp
index 3280377..c7a2d00 100644
--- a/src/websockets/qwebsocket_p.cpp
+++ b/src/websockets/qwebsocket_p.cpp
@@ -545,6 +545,10 @@ void QWebSocketPrivate::makeConnections(const QTcpSocket *pTcpSocket)
QObject::connect(pTcpSocket, &QAbstractSocket::aboutToClose, q, &QWebSocket::aboutToClose);
QObject::connect(pTcpSocket, &QAbstractSocket::bytesWritten, q, &QWebSocket::bytesWritten);
+
+ QObjectPrivate::connect(pTcpSocket, &QObject::destroyed,
+ this, &QWebSocketPrivate::socketDestroyed);
+
//catch signals
QObjectPrivate::connect(pTcpSocket, &QAbstractSocket::stateChanged, this,
&QWebSocketPrivate::processStateChanged);
@@ -1080,6 +1084,13 @@ void QWebSocketPrivate::processStateChanged(QAbstractSocket::SocketState socketS
}
}
+void QWebSocketPrivate::socketDestroyed(QObject *socket)
+{
+ Q_ASSERT(m_pSocket);
+ if (m_pSocket.data() == socket)
+ m_pSocket.take();
+}
+
/*!
\internal
*/
diff --git a/src/websockets/qwebsocket_p.h b/src/websockets/qwebsocket_p.h
index d9d0689..7379c51 100644
--- a/src/websockets/qwebsocket_p.h
+++ b/src/websockets/qwebsocket_p.h
@@ -162,6 +162,8 @@ private:
void setSocketState(QAbstractSocket::SocketState state);
void setErrorString(const QString &errorString);
+ void socketDestroyed(QObject *socket);
+
void processData();
void processPing(const QByteArray &data);
void processPong(const QByteArray &data);