diff options
Diffstat (limited to 'src/websockets/qwebsocket_p.cpp')
-rw-r--r-- | src/websockets/qwebsocket_p.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/websockets/qwebsocket_p.cpp b/src/websockets/qwebsocket_p.cpp index ced197e..76a5882 100644 --- a/src/websockets/qwebsocket_p.cpp +++ b/src/websockets/qwebsocket_p.cpp @@ -542,6 +542,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); @@ -1048,6 +1052,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 */ |