mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-27 23:17:13 +03:00
Don't abort propagation job abortions synchronously from finished
This leads to crashes since we changed the connection to the parent jobs not to be queued anymore. We don't really need to bubble up the finished state through parents in that case, and it would also mean that we'd recurse all the way through leaves as we go up to each parent. So just call abort directly on the OwncloudPropagator and make sure the abortion call is posted to the event loop.
This commit is contained in:
parent
19bf5e2ff1
commit
793a994ce6
2 changed files with 12 additions and 8 deletions
|
@ -171,6 +171,11 @@ void PropagateItemJob::done(SyncFileItem::Status status, const QString &errorStr
|
||||||
|
|
||||||
emit propagator()->itemCompleted(_item);
|
emit propagator()->itemCompleted(_item);
|
||||||
emit finished(status);
|
emit finished(status);
|
||||||
|
|
||||||
|
if (status == SyncFileItem::FatalError) {
|
||||||
|
// Abort all remaining jobs.
|
||||||
|
propagator()->abort();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -669,12 +674,9 @@ void PropagatorCompositeJob::slotSubJobFinished(SyncFileItem::Status status)
|
||||||
ASSERT(i >= 0);
|
ASSERT(i >= 0);
|
||||||
_runningJobs.remove(i);
|
_runningJobs.remove(i);
|
||||||
|
|
||||||
if (status == SyncFileItem::FatalError) {
|
if (status == SyncFileItem::FatalError
|
||||||
abort();
|
|| status == SyncFileItem::NormalError
|
||||||
_state = Finished;
|
|| status == SyncFileItem::SoftError) {
|
||||||
emit finished(status);
|
|
||||||
return;
|
|
||||||
} else if (status == SyncFileItem::NormalError || status == SyncFileItem::SoftError) {
|
|
||||||
_hasError = status;
|
_hasError = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -331,9 +331,11 @@ public:
|
||||||
void abort() {
|
void abort() {
|
||||||
_abortRequested.fetchAndStoreOrdered(true);
|
_abortRequested.fetchAndStoreOrdered(true);
|
||||||
if (_rootJob) {
|
if (_rootJob) {
|
||||||
_rootJob->abort();
|
// We're possibly already in an item's finished stack
|
||||||
|
QMetaObject::invokeMethod(_rootJob.data(), "abort", Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
emitFinished(SyncFileItem::NormalError);
|
// abort() of all jobs will likely have already resulted in finished being emitted, but just in case.
|
||||||
|
QMetaObject::invokeMethod(this, "emitFinished", Qt::QueuedConnection, Q_ARG(SyncFileItem::Status, SyncFileItem::NormalError));
|
||||||
}
|
}
|
||||||
|
|
||||||
// timeout in seconds
|
// timeout in seconds
|
||||||
|
|
Loading…
Reference in a new issue