[Pkg-owncloud-commits] [owncloud-client] 48/333: Fix the logs in the update phase

Sandro Knauß hefee-guest at moszumanska.debian.org
Thu Apr 17 23:16:32 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 89b5ddec56ee8c529899d887e0250638833e8088
Author: Olivier Goffart <ogoffart at woboq.com>
Date:   Tue Feb 18 13:48:13 2014 +0100

    Fix the logs in the update phase
    
    Since csync use a thread local variable for the logs, we need
    to reset it when we enter the update thread
---
 src/mirall/csyncthread.cpp |  3 +--
 src/mirall/csyncthread.h   | 18 ++++++++++++++++--
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/src/mirall/csyncthread.cpp b/src/mirall/csyncthread.cpp
index 31d1bb3..c8d1f68 100644
--- a/src/mirall/csyncthread.cpp
+++ b/src/mirall/csyncthread.cpp
@@ -495,8 +495,7 @@ void CSyncThread::startSync()
 
     qDebug() << "#### Update start #################################################### >>";
 
-    UpdateJob *job = new UpdateJob;
-    job->_csync_ctx = _csync_ctx;
+    UpdateJob *job = new UpdateJob(_csync_ctx);
     job->moveToThread(&_thread);
     connect(job, SIGNAL(finished(int)), this, SLOT(slotUpdateFinished(int)));
     QMetaObject::invokeMethod(job, "start");
diff --git a/src/mirall/csyncthread.h b/src/mirall/csyncthread.h
index d559169..96a02d1 100644
--- a/src/mirall/csyncthread.h
+++ b/src/mirall/csyncthread.h
@@ -127,14 +127,28 @@ private:
 };
 
 
-struct UpdateJob : public QObject {
+class UpdateJob : public QObject {
     Q_OBJECT
-public:
     CSYNC *_csync_ctx;
+    csync_log_callback _log_callback;
+    int _log_level;
+    void* _log_userdata;
     Q_INVOKABLE void start() {
+        csync_set_log_callback(_log_callback);
+        csync_set_log_level(_log_level);
+        csync_set_log_userdata(_log_userdata);
         emit finished(csync_update(_csync_ctx));
         deleteLater();
     }
+public:
+    explicit UpdateJob(CSYNC *ctx, QObject* parent = 0)
+            : QObject(parent), _csync_ctx(ctx) {
+        // We need to forward the log property as csync uses thread local
+        // and updates run in another thread
+        _log_callback = csync_get_log_callback();
+        _log_level = csync_get_log_level();
+        _log_userdata = csync_get_log_userdata();
+    }
 signals:
     void finished(int result);
 };

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