Discovery: Fix aborting during discovery #6972
authorChristian Kamm <mail@ckamm.de>
Mon, 14 Jan 2019 14:41:34 +0000 (15:41 +0100)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 15 Dec 2020 09:58:34 +0000 (10:58 +0100)
src/libsync/syncengine.cpp

index b02e951c9e2f0c728fc12c3edffcec989806cb99..afa8cdfdb1751533dbe0649489cf56b109dea3d2 100644 (file)
@@ -1033,14 +1033,17 @@ void SyncEngine::abort()
     if (_propagator)
         qCInfo(lcEngine) << "Aborting sync";
 
-    // Aborts the discovery phase job
-    if (_discoveryPhase) {
-        // Should take care to delete all children jobs
-        _discoveryPhase.take()->deleteLater();
-    }
-    // For the propagator
     if (_propagator) {
+        // If we're already in the propagation phase, aborting that is sufficient
         _propagator->abort();
+    } else if (_discoveryPhase) {
+        // Delete the discovery and all child jobs after ensuring
+        // it can't finish and start the propagator
+        disconnect(_discoveryPhase.data(), 0, this, 0);
+        _discoveryPhase.take()->deleteLater();
+
+        syncError(tr("Aborted"));
+        finalize(false);
     }
 }