From: Olivier Goffart Date: Wed, 15 Jun 2016 15:01:00 +0000 (+0200) Subject: SyncEngine: make abort and closing more robust X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~1150^2~17 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=92309013dae728b66c597697de7572b6d8e50f1a;p=nextcloud-desktop.git SyncEngine: make abort and closing more robust We first need to set the abort flag to csync and then aborting the discovery job, otherwise, the discovery thread could start a new job in the mean time. We also need to make sure that the thread has existed before we destroy the exclude list. --- diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp index 36fefc036..d71eba882 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -101,10 +101,10 @@ SyncEngine::SyncEngine(AccountPtr account, const QString& localPath, SyncEngine::~SyncEngine() { abort(); - _excludedFiles.reset(); - csync_destroy(_csync_ctx); _thread.quit(); _thread.wait(); + _excludedFiles.reset(); + csync_destroy(_csync_ctx); } //Convert an error code from csync to a user readable string. @@ -1379,13 +1379,13 @@ AccountPtr SyncEngine::account() const void SyncEngine::abort() { + // Sets a flag for the update phase + csync_request_abort(_csync_ctx); qDebug() << Q_FUNC_INFO << _discoveryMainThread; // Aborts the discovery phase job if (_discoveryMainThread) { _discoveryMainThread->abort(); } - // Sets a flag for the update phase - csync_request_abort(_csync_ctx); // For the propagator if(_propagator) { _propagator->abort();