From 48864a69210bcafb3467a0cf93e5fd907f4aa342 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 25 Jun 2014 12:15:30 +0200 Subject: [PATCH] httpcredentials: Remove useless mutex The mutex is not shared with any thread, so it is totaly useless. Yes: there are possible races here. (with the account, but also with the user and password) --- src/creds/httpcredentials.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/creds/httpcredentials.cpp b/src/creds/httpcredentials.cpp index f5ab3b68b..72d238713 100644 --- a/src/creds/httpcredentials.cpp +++ b/src/creds/httpcredentials.cpp @@ -48,8 +48,9 @@ int getauth(const char *prompt, void *userdata) { int re = 0; - QMutex mutex; - // ### safe? + + // ### safe? Not really. If the wizard is run in the main thread, the caccount could change during the sync. + // Ideally, http_credentials could be use userdata, but userdata is the SyncEngine. HttpCredentials* http_credentials = qobject_cast(AccountManager::instance()->account()->credentials()); if (!http_credentials) { @@ -63,10 +64,8 @@ int getauth(const char *prompt, if( qPrompt == QLatin1String("Enter your username:") ) { // qDebug() << "OOO Username requested!"; - QMutexLocker locker( &mutex ); qstrncpy( buf, user.toUtf8().constData(), len ); } else if( qPrompt == QLatin1String("Enter your password:") ) { - QMutexLocker locker( &mutex ); // qDebug() << "OOO Password requested!"; qstrncpy( buf, pwd.toUtf8().constData(), len ); } else {