Discovery: Fix aborting during discovery #6972

This commit is contained in:
Christian Kamm 2019-01-14 15:41:34 +01:00 committed by Kevin Ottens
parent 836d298141
commit 9f8505c736
No known key found for this signature in database
GPG key ID: 074BBBCB8DECC9E2

View 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);
}
}