diff options
author | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2020-06-26 11:37:19 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2020-06-26 11:45:07 +0000 |
commit | eb2ddd0cb6b6f6ad391b5b43dbc1e88e41238417 (patch) | |
tree | 6a58f6777dbf87a8bf9234e15d8fd6e16045a647 | |
parent | 34010e649734fe7a41d1a0280c606b15de5c2799 (diff) | |
download | qtwebsockets-eb2ddd0cb6b6f6ad391b5b43dbc1e88e41238417.tar.gz |
QSslServer - adopt the newly created socket
Like it's done in QTcpServer. In theory, it's possible that 'encrypted'
signal is never executed and then the socket is not added to the pending
connections (those are deleted in the QTcpServer::close).
Thus, the socket object would be leaked. Since QSslServer inherits from
QTcpServer, this fix also ensures the documented behavior of the
QTcpServer::nextPendingConnection (which is said to return a child
of the server object).
Fixes: QTBUG-85180
Change-Id: Ic0d923b7a7fe5e3bcea0b9815be1cbe946dda186
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 788d4856330e6f5d251f9b153de3d22b8cf538f1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/websockets/qsslserver.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/websockets/qsslserver.cpp b/src/websockets/qsslserver.cpp index ec645c9..1bc05bb 100644 --- a/src/websockets/qsslserver.cpp +++ b/src/websockets/qsslserver.cpp @@ -107,7 +107,7 @@ QSslConfiguration QSslServer::sslConfiguration() const */ void QSslServer::incomingConnection(qintptr socket) { - QSslSocket *pSslSocket = new QSslSocket(); + QSslSocket *pSslSocket = new QSslSocket(this); if (Q_LIKELY(pSslSocket)) { pSslSocket->setSslConfiguration(m_sslConfiguration); |