summaryrefslogtreecommitdiffstats
path: root/src/plugins/tls/openssl/qsslcontext_openssl.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2021-07-12 11:41:43 +0200
committerMarc Mutz <marc.mutz@kdab.com>2021-07-18 13:49:04 +0200
commit93fdd88a422e9447ffe7a71b8caf1f4075e8ecf3 (patch)
tree94129cb1b6fecbaa964b19677d9b1817c4c1cfff /src/plugins/tls/openssl/qsslcontext_openssl.cpp
parent90d8eaad8f0fd50033169f859b450aab0303e99b (diff)
Hold QSslContext in shared_ptr
... instead of QSharedPointer. QSharedPointer performs twice as many atomic operations per pointer copy as std::shared_ptr, and this is private API, we're not bound by BC constraints, so we can port to the more efficient version. Change-Id: I2e2a02493565a7ca51c86ec0ed66b6ce7c763e41 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/plugins/tls/openssl/qsslcontext_openssl.cpp')
-rw-r--r--src/plugins/tls/openssl/qsslcontext_openssl.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/plugins/tls/openssl/qsslcontext_openssl.cpp b/src/plugins/tls/openssl/qsslcontext_openssl.cpp
index ee69f5aa44..1b32ad37dc 100644
--- a/src/plugins/tls/openssl/qsslcontext_openssl.cpp
+++ b/src/plugins/tls/openssl/qsslcontext_openssl.cpp
@@ -172,14 +172,15 @@ QSslContext::~QSslContext()
q_SSL_SESSION_free(session);
}
-QSharedPointer<QSslContext> QSslContext::sharedFromConfiguration(QSslSocket::SslMode mode, const QSslConfiguration &configuration, bool allowRootCertOnDemandLoading)
+std::shared_ptr<QSslContext> QSslContext::sharedFromConfiguration(QSslSocket::SslMode mode, const QSslConfiguration &configuration, bool allowRootCertOnDemandLoading)
{
- QSharedPointer<QSslContext> sslContext = QSharedPointer<QSslContext>::create();
- initSslContext(sslContext.data(), mode, configuration, allowRootCertOnDemandLoading);
+ struct AccessToPrivateCtor : QSslContext {};
+ std::shared_ptr<QSslContext> sslContext = std::make_shared<AccessToPrivateCtor>();
+ initSslContext(sslContext.get(), mode, configuration, allowRootCertOnDemandLoading);
return sslContext;
}
-QSharedPointer<QSslContext> QSslContext::sharedFromPrivateConfiguration(QSslSocket::SslMode mode, QSslConfigurationPrivate *privConfiguration,
+std::shared_ptr<QSslContext> QSslContext::sharedFromPrivateConfiguration(QSslSocket::SslMode mode, QSslConfigurationPrivate *privConfiguration,
bool allowRootCertOnDemandLoading)
{
return sharedFromConfiguration(mode, privConfiguration, allowRootCertOnDemandLoading);