Removed block parameter from terminateSync.

Do not pretend to immediately terminate the sync but let csync
finish planfully and free the mutex.
This commit is contained in:
Klaas Freitag 2014-05-13 13:39:00 +02:00
parent cdd8c8165b
commit 64f4d1b387
5 changed files with 12 additions and 19 deletions

View File

@ -361,7 +361,7 @@ void AccountSettings::slotResetCurrentFolder()
if( ret == QMessageBox::Yes ) {
FolderMan *folderMan = FolderMan::instance();
Folder *f = folderMan->folder(alias);
f->slotTerminateSync(true);
f->slotTerminateSync();
f->wipe();
folderMan->slotScheduleAllFolders();
}
@ -478,7 +478,7 @@ void AccountSettings::slotEnableCurrentFolder()
// message box can return at any time while the thread keeps running,
// so better check again after the user has responded.
if ( f->isBusy() && terminate ) {
f->slotTerminateSync(false);
f->slotTerminateSync();
}
folderMan->slotEnableFolder( alias, !folderEnabled );

View File

@ -466,7 +466,7 @@ void Folder::slotThreadTreeWalkResult(const SyncFileItemVector& items)
_syncResult.setSyncFileItemVector(items);
}
void Folder::slotTerminateSync(bool block)
void Folder::slotTerminateSync()
{
qDebug() << "folder " << alias() << " Terminating!";
@ -476,14 +476,10 @@ void Folder::slotTerminateSync(bool block)
// Do not display an error message, user knows his own actions.
// _errors.append( tr("The CSync thread terminated.") );
// _csyncError = true;
if (!block) {
setSyncState(SyncResult::SyncAbortRequested);
return;
}
slotSyncFinished();
setSyncEnabled(false);
setSyncState(SyncResult::SyncAbortRequested);
return;
}
setSyncEnabled(false);
}
// This removes the csync File database

View File

@ -148,10 +148,8 @@ public slots:
/**
* terminate the current sync run
*
* If block is true, this will block synchroniously for the sync thread to finish.
*/
void slotTerminateSync(bool block);
void slotTerminateSync();
void slotAboutToRemoveAllFiles(SyncFileItem::Direction, bool*);

View File

@ -353,9 +353,10 @@ void FolderMan::terminateSyncProcess( const QString& alias )
if( ! folderAlias.isEmpty() && _folderMap.contains(folderAlias) ) {
Folder *f = _folderMap[folderAlias];
if( f ) {
f->slotTerminateSync(true);
if(_currentSyncFolder == folderAlias )
f->slotTerminateSync();
if(_currentSyncFolder == folderAlias ) {
_currentSyncFolder.clear();
}
}
}
}

View File

@ -210,21 +210,19 @@ public:
/* The number of currently active jobs */
int _activeJobs;
bool isInSharedDirectory(const QString& file);
void abort() {
_abortRequested.fetchAndStoreOrdered(true);
if (_rootJob)
if (_rootJob) {
_rootJob->abort();
}
emit finished();
}
// timeout in seconds
static int httpTimeout();
signals:
void completed(const SyncFileItem &);
void progress(const SyncFileItem&, quint64 bytes);