diff options
-rw-r--r-- | src/websockets/qwebsocketserver.cpp | 2 | ||||
-rw-r--r-- | src/websockets/qwebsocketserver_p.cpp | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/websockets/qwebsocketserver.cpp b/src/websockets/qwebsocketserver.cpp index 59cfd89..b7368b3 100644 --- a/src/websockets/qwebsocketserver.cpp +++ b/src/websockets/qwebsocketserver.cpp @@ -247,6 +247,8 @@ QWebSocketServer::QWebSocketServer(const QString &serverName, SslMode secureMode */ QWebSocketServer::~QWebSocketServer() { + Q_D(QWebSocketServer); + d->close(true); } /*! diff --git a/src/websockets/qwebsocketserver_p.cpp b/src/websockets/qwebsocketserver_p.cpp index 28f9bea..77caa51 100644 --- a/src/websockets/qwebsocketserver_p.cpp +++ b/src/websockets/qwebsocketserver_p.cpp @@ -74,7 +74,7 @@ QWebSocketServerPrivate::QWebSocketServerPrivate(const QString &serverName, void QWebSocketServerPrivate::init() { if (m_secureMode == NonSecureMode) { - m_pTcpServer = new QTcpServer(); + m_pTcpServer = new QTcpServer(q_ptr); if (Q_LIKELY(m_pTcpServer)) QObjectPrivate::connect(m_pTcpServer, &QTcpServer::newConnection, this, &QWebSocketServerPrivate::onNewConnection); @@ -82,7 +82,7 @@ void QWebSocketServerPrivate::init() qFatal("Could not allocate memory for tcp server."); } else { #ifndef QT_NO_SSL - QSslServer *pSslServer = new QSslServer(); + QSslServer *pSslServer = new QSslServer(q_ptr); m_pTcpServer = pSslServer; if (Q_LIKELY(m_pTcpServer)) { QObjectPrivate::connect(pSslServer, &QSslServer::newEncryptedConnection, @@ -105,8 +105,6 @@ void QWebSocketServerPrivate::init() */ QWebSocketServerPrivate::~QWebSocketServerPrivate() { - close(true); - m_pTcpServer->deleteLater(); } /*! |