[Pkg-owncloud-commits] [owncloud-client] 134/332: httpcredentials: Remove useless mutex

Sandro Knauß hefee-guest at moszumanska.debian.org
Thu Aug 14 21:06:50 UTC 2014


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 48864a69210bcafb3467a0cf93e5fd907f4aa342
Author: Olivier Goffart <ogoffart at woboq.com>
Date:   Wed Jun 25 12:15:30 2014 +0200

    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 f5ab3b6..72d2387 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<HttpCredentials*>(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 {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list