[Pkg-owncloud-commits] [owncloud-client] 133/211: SyncEngine: Avoid transaction warning

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat Oct 25 09:10:37 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 2de22b408b642babac149f57397270bd839dd779
Author: Markus Goetz <markus at woboq.com>
Date:   Mon Oct 20 17:20:58 2014 +0200

    SyncEngine: Avoid transaction warning
---
 src/mirall/syncengine.cpp    |  2 +-
 src/mirall/syncjournaldb.cpp | 10 ++++++++++
 src/mirall/syncjournaldb.h   |  1 +
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/mirall/syncengine.cpp b/src/mirall/syncengine.cpp
index 23458f5..8e6b457 100644
--- a/src/mirall/syncengine.cpp
+++ b/src/mirall/syncengine.cpp
@@ -618,7 +618,7 @@ void SyncEngine::slotDiscoveryJobFinished(int discoveryResult)
         return;
     } else {
         // Commits a possibly existing (should not though) transaction and starts a new one for the propagate phase
-        _journal->commit("pre Propagate");
+        _journal->commitIfNeededAndStartNewTransaction("Post discovery");
     }
 
     if( csync_reconcile(_csync_ctx) < 0 ) {
diff --git a/src/mirall/syncjournaldb.cpp b/src/mirall/syncjournaldb.cpp
index 128714f..569e230 100644
--- a/src/mirall/syncjournaldb.cpp
+++ b/src/mirall/syncjournaldb.cpp
@@ -1046,6 +1046,16 @@ void SyncJournalDb::commit(const QString& context, bool startTrans)
     commitInternal(context, startTrans);
 }
 
+void SyncJournalDb::commitIfNeededAndStartNewTransaction(const QString &context)
+{
+    QMutexLocker lock(&_mutex);
+    if( _transaction == 1 ) {
+        commitInternal(context, true);
+    } else {
+        startTransaction();
+    }
+}
+
 
 void SyncJournalDb::commitInternal(const QString& context, bool startTrans )
 {
diff --git a/src/mirall/syncjournaldb.h b/src/mirall/syncjournaldb.h
index 06160f3..74e9455 100644
--- a/src/mirall/syncjournaldb.h
+++ b/src/mirall/syncjournaldb.h
@@ -93,6 +93,7 @@ public:
      * Commit will actually commit the transaction and create a new one.
      */
     void commit(const QString &context, bool startTrans = true);
+    void commitIfNeededAndStartNewTransaction(const QString &context);
 
     void close();
 

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