summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@qt.io>2020-06-26 11:37:19 +0200
committerTimur Pocheptsov <timur.pocheptsov@qt.io>2020-06-26 13:28:45 +0200
commit788d4856330e6f5d251f9b153de3d22b8cf538f1 (patch)
tree6394e46b4009893dc651c7fc2b60564d70908b7d
parentd805ecbfe7fc1ad810e24624ef8c339fc6e2302d (diff)
downloadqtwebsockets-788d4856330e6f5d251f9b153de3d22b8cf538f1.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 Pick-to: 5.15 Change-Id: Ic0d923b7a7fe5e3bcea0b9815be1cbe946dda186 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
-rw-r--r--src/websockets/qsslserver.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/websockets/qsslserver.cpp b/src/websockets/qsslserver.cpp
index 7f33a9d..ed4e4c0 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);