25
25
#include < QSslConfiguration>
26
26
#include < QSslError>
27
27
#endif
28
+ #include < QMutexLocker>
28
29
29
30
#include " qgsauthcertutils.h"
30
31
#include " qgsauthmanager.h"
@@ -50,6 +51,7 @@ QgsAuthIdentCertMethod::QgsAuthIdentCertMethod()
50
51
51
52
QgsAuthIdentCertMethod::~QgsAuthIdentCertMethod ()
52
53
{
54
+ QMutexLocker locker ( &mConfigMutex );
53
55
qDeleteAll ( sPkiConfigBundleCache );
54
56
sPkiConfigBundleCache .clear ();
55
57
}
@@ -219,6 +221,7 @@ void QgsAuthIdentCertMethod::updateMethodConfig( QgsAuthMethodConfig &mconfig )
219
221
220
222
QgsPkiConfigBundle *QgsAuthIdentCertMethod::getPkiConfigBundle ( const QString &authcfg )
221
223
{
224
+ QMutexLocker locker ( &mConfigMutex );
222
225
QgsPkiConfigBundle *bundle = nullptr ;
223
226
224
227
// check if it is cached
@@ -263,6 +266,7 @@ QgsPkiConfigBundle *QgsAuthIdentCertMethod::getPkiConfigBundle( const QString &a
263
266
264
267
bundle = new QgsPkiConfigBundle ( mconfig, clientcert, clientkey );
265
268
269
+ locker.unlock ();
266
270
// cache bundle
267
271
putPkiConfigBundle ( authcfg, bundle );
268
272
@@ -271,12 +275,14 @@ QgsPkiConfigBundle *QgsAuthIdentCertMethod::getPkiConfigBundle( const QString &a
271
275
272
276
void QgsAuthIdentCertMethod::putPkiConfigBundle ( const QString &authcfg, QgsPkiConfigBundle *pkibundle )
273
277
{
278
+ QMutexLocker locker ( &mConfigMutex );
274
279
QgsDebugMsg ( QString ( " Putting PKI bundle for authcfg %1" ).arg ( authcfg ) );
275
280
sPkiConfigBundleCache .insert ( authcfg, pkibundle );
276
281
}
277
282
278
283
void QgsAuthIdentCertMethod::removePkiConfigBundle ( const QString &authcfg )
279
284
{
285
+ QMutexLocker locker ( &mConfigMutex );
280
286
if ( sPkiConfigBundleCache .contains ( authcfg ) )
281
287
{
282
288
QgsPkiConfigBundle *pkibundle = sPkiConfigBundleCache .take ( authcfg );
0 commit comments