[Pkg-owncloud-commits] [owncloud-client] 30/115: Revert "FolderMan: Proper singleton implementation."

Sandro Knauß hefee-guest at moszumanska.debian.org
Fri Aug 29 22:03:57 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 d27ab8c6caab96b25c0cabb1dadb3b6f775dd279
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Thu Aug 14 12:46:01 2014 +0200

    Revert "FolderMan: Proper singleton implementation."
    
    This reverts commit 0350508b651d3ad16fe6ede76a975e0b41bacaaf.
---
 src/mirall/application.h |  3 +++
 src/mirall/folderman.cpp | 11 ++---------
 src/mirall/socketapi.cpp |  9 ++++-----
 3 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/src/mirall/application.h b/src/mirall/application.h
index bdd4758..02690cc 100644
--- a/src/mirall/application.h
+++ b/src/mirall/application.h
@@ -28,6 +28,7 @@
 #include "mirall/connectionvalidator.h"
 #include "mirall/progressdispatcher.h"
 #include "mirall/clientproxy.h"
+#include "mirall/folderman.h"
 
 class QMessageBox;
 class QSystemTrayIcon;
@@ -105,6 +106,8 @@ private:
 
     QTimer _checkConnectionTimer;
 
+    FolderMan folderManager;
+
     friend class ownCloudGui; // for _startupNetworkError
 };
 
diff --git a/src/mirall/folderman.cpp b/src/mirall/folderman.cpp
index 33c377a..5729c4d 100644
--- a/src/mirall/folderman.cpp
+++ b/src/mirall/folderman.cpp
@@ -49,21 +49,14 @@ FolderMan::FolderMan(QObject *parent) :
             this, SLOT(slotScheduleSync(const QString&)));
 
     ne_sock_init();
+    Q_ASSERT(!_instance);
+    _instance = this;
 
     _socketApi = new SocketApi(this);
 }
 
 FolderMan *FolderMan::instance()
 {
-    static QMutex mutex;
-    if (!_instance)
-    {
-        QMutexLocker lock(&mutex);
-        if (!_instance) {
-            _instance = new FolderMan;
-        }
-    }
-
     return _instance;
 }
 
diff --git a/src/mirall/socketapi.cpp b/src/mirall/socketapi.cpp
index 7fb0618..1f5f02a 100644
--- a/src/mirall/socketapi.cpp
+++ b/src/mirall/socketapi.cpp
@@ -187,6 +187,10 @@ SocketApi::SocketApi(QObject* parent)
     }
     connect(_localServer, SIGNAL(newConnection()), this, SLOT(slotNewConnection()));
 
+    // folder watcher
+    connect(FolderMan::instance(), SIGNAL(folderSyncStateChange(QString)), this, SLOT(slotUpdateFolderView(QString)));
+    connect(ProgressDispatcher::instance(), SIGNAL(jobCompleted(QString,SyncFileItem)),
+            SLOT(slotJobCompleted(QString,SyncFileItem)));
 }
 
 SocketApi::~SocketApi()
@@ -202,11 +206,6 @@ void SocketApi::slotNewConnection()
     if( ! socket ) {
         return;
     }
-    // folder watcher
-    connect(FolderMan::instance(), SIGNAL(folderSyncStateChange(QString)), this, SLOT(slotUpdateFolderView(QString)));
-    connect(ProgressDispatcher::instance(), SIGNAL(jobCompleted(QString,SyncFileItem)),
-            SLOT(slotJobCompleted(QString,SyncFileItem)));
-
     DEBUG << "New connection" << socket;
     connect(socket, SIGNAL(readyRead()), this, SLOT(slotReadSocket()));
     connect(socket, SIGNAL(disconnected()), this, SLOT(onLostConnection()));

-- 
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