From dc707f0855a7b8a5c98456d4b8cd65d1a7ea3514 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 11 Feb 2019 16:44:14 +0100 Subject: Make client certificate store thread safe If the users manipulate the API from the UI, we need to read from the UI thread as well. Change-Id: I8af787a357954cff4fbdd94bcf27b880fb6aecb4 Reviewed-by: Michal Klocek --- src/core/api/qwebengineclientcertificatestore.cpp | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'src/core/api/qwebengineclientcertificatestore.cpp') diff --git a/src/core/api/qwebengineclientcertificatestore.cpp b/src/core/api/qwebengineclientcertificatestore.cpp index 850dd16d7..40412dfd8 100644 --- a/src/core/api/qwebengineclientcertificatestore.cpp +++ b/src/core/api/qwebengineclientcertificatestore.cpp @@ -112,7 +112,7 @@ void QWebEngineClientCertificateStore::add(const QSslCertificate &certificate, c QList QWebEngineClientCertificateStore::toList() const { QList certificateList; - for (auto data : qAsConst(d_ptr->addedCerts)) { + for (auto data : qAsConst(d_ptr->extraCerts)) { Entry entry; entry.certificate = data->certificate; entry.privateKey = data->key; @@ -123,21 +123,12 @@ QList QWebEngineClientCertificateStore: /*! Deletes all the instances of the client certificate in the in-memory client certificate store - that matches the certificate in the \a entry. + that matches the certificate \a certificate. */ -void QWebEngineClientCertificateStore::remove(Entry entry) +void QWebEngineClientCertificateStore::remove(const QSslCertificate &certificate) { - auto it = d_ptr->addedCerts.begin(); - while (it != d_ptr->addedCerts.end()) { - auto *overrideData = *it; - if (entry.certificate.toDer() == overrideData->certificate.toDer()) { - d_ptr->deletedCerts.append(overrideData); - it = d_ptr->addedCerts.erase(it); - continue; - } - ++it; - } + d_ptr->remove(certificate); } /*! @@ -146,8 +137,7 @@ void QWebEngineClientCertificateStore::remove(Entry entry) void QWebEngineClientCertificateStore::clear() { - d_ptr->deletedCerts.append(d_ptr->addedCerts); - d_ptr->addedCerts.clear(); + d_ptr->clear(); } #endif // QT_CONFIG(ssl) -- cgit v1.2.3