summaryrefslogtreecommitdiff
path: root/src/websockets/qwebsocket_p.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/websockets/qwebsocket_p.cpp')
-rw-r--r--src/websockets/qwebsocket_p.cpp11
1 files changed, 11 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
*/