From 9cc0c64e0857ded99e5031548ae9b7fc8107caf8 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 12 Jul 2021 11:28:19 +0200 Subject: SSL: port QSharedPointer uses to std-compatible API subset MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In preparation of porting to shared_ptr. Add a few strategic moves and remove a rather pointless comment stating the obvious. Change-Id: Ie1c0f3431af79bdb204e00d99323bf9f2d100d0d Reviewed-by: Edward Welbourne Reviewed-by: MÃ¥rten Nordheim --- src/plugins/tls/openssl/qtls_openssl.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/plugins/tls/openssl/qtls_openssl.cpp') diff --git a/src/plugins/tls/openssl/qtls_openssl.cpp b/src/plugins/tls/openssl/qtls_openssl.cpp index dbbd9b29a8..ec4303bcdc 100644 --- a/src/plugins/tls/openssl/qtls_openssl.cpp +++ b/src/plugins/tls/openssl/qtls_openssl.cpp @@ -506,8 +506,8 @@ void TlsCryptographOpenSSL::init(QSslSocket *qObj, QSslSocketPrivate *dObj) void TlsCryptographOpenSSL::checkSettingSslContext(QSharedPointer tlsContext) { - if (sslContextPointer.isNull()) - sslContextPointer = tlsContext; + if (!sslContextPointer) + sslContextPointer = std::move(tlsContext); } QSharedPointer TlsCryptographOpenSSL::sslContext() const @@ -815,7 +815,7 @@ void TlsCryptographOpenSSL::continueHandshake() // Cache this SSL session inside the QSslContext if (!(configuration.testSslOption(QSsl::SslOptionDisableSessionSharing))) { if (!sslContextPointer->cacheSession(ssl)) { - sslContextPointer.clear(); // we could not cache the session + sslContextPointer.reset(); // we could not cache the session } else { // Cache the session for permanent usage as well if (!(configuration.testSslOption(QSsl::SslOptionDisableSessionPersistence))) { @@ -1367,7 +1367,7 @@ bool TlsCryptographOpenSSL::initSslContext() if (sslContextPointer->error() != QSslError::NoError) { setErrorAndEmit(d, QAbstractSocket::SslInvalidUserDataError, sslContextPointer->errorString()); - sslContextPointer.clear(); // deletes the QSslContext + sslContextPointer.reset(); return false; } @@ -1495,7 +1495,7 @@ void TlsCryptographOpenSSL::destroySslContext() q_SSL_free(ssl); ssl = nullptr; } - sslContextPointer.clear(); + sslContextPointer.reset(); } void TlsCryptographOpenSSL::storePeerCertificates() -- cgit v1.2.3