diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp index b02e951c9..afa8cdfdb 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -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); } }