[Pkg-owncloud-commits] [owncloud-client] 300/484: FolderMan: Fix infinite wait on pause #4093

Sandro Knauß hefee-guest at moszumanska.debian.org
Wed Dec 16 00:37:56 UTC 2015


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 01aa647527fd6f0f13e0aeb18a09c62735720642
Author: Christian Kamm <mail at ckamm.de>
Date:   Wed Nov 11 10:56:19 2015 +0100

    FolderMan: Fix infinite wait on pause #4093
    
    If a folder was paused while being the next item in the scheduling
    queue, the whole scheduling could get stuck.
    
    This also fixes the progress information of paused folders possibly
    getting stuck.
---
 src/gui/folderman.cpp         | 22 ++++++++++++++--------
 src/gui/folderstatusmodel.cpp |  5 ++++-
 2 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/src/gui/folderman.cpp b/src/gui/folderman.cpp
index c5ff99e..3aacb73 100644
--- a/src/gui/folderman.cpp
+++ b/src/gui/folderman.cpp
@@ -427,14 +427,13 @@ void FolderMan::slotSetFolderPaused( Folder *f, bool paused )
         return;
     }
 
-    slotScheduleSync(f);
-
+    f->setSyncPaused(paused);
     if (!paused) {
         _disabledFolders.remove(f);
+        slotScheduleSync(f);
     } else {
         _disabledFolders.insert(f);
     }
-    f->setSyncPaused(paused);
     emit folderSyncStateChange(f);
 }
 
@@ -681,15 +680,22 @@ void FolderMan::slotStartScheduledFolderSync()
         return;
     }
 
-    // Try to start the top scheduled sync.
-    Folder *f = _scheduleQueue.dequeue();
+    // Find the first folder in the queue that can be synced.
+    Folder* f = nullptr;
+    while( !_scheduleQueue.isEmpty() ) {
+        f = _scheduleQueue.dequeue();
+        Q_ASSERT(f);
+
+        if( f->canSync() ) {
+            break;
+        }
+    }
+
     emit scheduleQueueChanged();
-    Q_ASSERT(f);
 
     // Start syncing this folder!
-    if(f->canSync()) {
+    if( f ) {
         _currentSyncFolder = f;
-
         f->startSync( QStringList() );
     }
 }
diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp
index fc8277c..b8dba5b 100644
--- a/src/gui/folderstatusmodel.cpp
+++ b/src/gui/folderstatusmodel.cpp
@@ -925,7 +925,10 @@ void FolderStatusModel::slotFolderSyncStateChange(Folder *f)
     if (folderIndex < 0) { return; }
 
     SyncResult::Status state = f->syncResult().status();
-    if (state == SyncResult::NotYetStarted) {
+    if (f->syncPaused()) {
+        // Reset progress info.
+        _folders[folderIndex]._progress = SubFolderInfo::Progress();
+    } else if (state == SyncResult::NotYetStarted) {
         FolderMan* folderMan = FolderMan::instance();
         int pos = folderMan->scheduleQueue().indexOf(f);
         if (folderMan->currentSyncFolder()

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