summaryrefslogtreecommitdiffstats
path: root/src/core/api/qwebengineclientcertificatestore.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-02-11 16:44:14 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-02-25 14:08:39 +0000
commitdc707f0855a7b8a5c98456d4b8cd65d1a7ea3514 (patch)
treeb36c91f37f3345f16168b3104d1b841f6a6b22ef /src/core/api/qwebengineclientcertificatestore.cpp
parent678cb710bb07188454b19a70b5e5595b8ea41c2a (diff)
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 <michal.klocek@qt.io>
Diffstat (limited to 'src/core/api/qwebengineclientcertificatestore.cpp')
-rw-r--r--src/core/api/qwebengineclientcertificatestore.cpp20
1 files changed, 5 insertions, 15 deletions
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::Entry> QWebEngineClientCertificateStore::toList() const
{
QList<Entry> 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::Entry> 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)