FolderMan: Fix for removing a syncing folder #3843

We can't schedule the next folder if we aren't notified that
the removed folder has finished syncing...
This commit is contained in:
Christian Kamm 2015-09-18 14:34:01 +02:00
parent c5c1a7a1c3
commit c1045af500

View file

@ -841,9 +841,7 @@ void FolderMan::slotRemoveFolder( Folder *f )
const bool currentlyRunning = (_currentSyncFolder == f); const bool currentlyRunning = (_currentSyncFolder == f);
if( currentlyRunning ) { if( currentlyRunning ) {
// let the folder delete itself when done and
// abort the sync now // abort the sync now
connect(f, SIGNAL(syncFinished(SyncResult)), f, SLOT(deleteLater()));
terminateSyncProcess(); terminateSyncProcess();
} }
@ -858,7 +856,13 @@ void FolderMan::slotRemoveFolder( Folder *f )
f->removeFromSettings(); f->removeFromSettings();
unloadFolder( f); unloadFolder( f);
if( !currentlyRunning ) { if( currentlyRunning ) {
// We want to schedule the next folder once this is done
connect(f, SIGNAL(syncFinished(SyncResult)),
SLOT(slotFolderSyncFinished(SyncResult)));
// Let the folder delete itself when done.
connect(f, SIGNAL(syncFinished(SyncResult)), f, SLOT(deleteLater()));
} else {
delete f; delete f;
} }
} }