Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
QgsAuthManager::instance(): avoid incorrect double-checked locking pa…
  • Loading branch information
rouault committed May 29, 2020
1 parent cf117d7 commit 02ac606
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/core/auth/qgsauthmanager.cpp
Expand Up @@ -84,6 +84,10 @@ const QString QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME( "Password Manag

QgsAuthManager *QgsAuthManager::instance()
{
// NOTE cppcheck complains about identicalInnerCondition. Pedantically
// the below construct is not totally thread-safe.
// See https://preshing.com/20130930/double-checked-locking-is-fixed-in-cpp11/
// regarding double-checked locking pattern (DCLP)
if ( !sInstance )
{
static QMutex sMutex;
Expand Down

0 comments on commit 02ac606

Please sign in to comment.