From 815e0fee8fb9249a8cc591759b1d525b4660e921 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Mon, 8 Oct 2018 12:36:43 +0200 Subject: [PATCH] Propagator: Add assert against duplicate done() calls --- src/libsync/owncloudpropagator.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libsync/owncloudpropagator.cpp b/src/libsync/owncloudpropagator.cpp index bb23e2843..9ca0756d9 100644 --- a/src/libsync/owncloudpropagator.cpp +++ b/src/libsync/owncloudpropagator.cpp @@ -217,9 +217,12 @@ static void blacklistUpdate(SyncJournalDb *journal, SyncFileItem &item) void PropagateItemJob::done(SyncFileItem::Status statusArg, const QString &errorString) { + // Duplicate calls to done() are a logic error + ENFORCE(_state != Finished); + _state = Finished; + _item->_status = statusArg; - _state = Finished; if (_item->_isRestoration) { if (_item->_status == SyncFileItem::Success || _item->_status == SyncFileItem::Conflict) { @@ -829,7 +832,7 @@ void PropagatorCompositeJob::slotSubJobFinished(SyncFileItem::Status status) // Delete the job and remove it from our list of jobs. subJob->deleteLater(); int i = _runningJobs.indexOf(subJob); - ASSERT(i >= 0); + ENFORCE(i >= 0); // should only happen if this function is called more than once _runningJobs.remove(i); // Any sub job error will cause the whole composite to fail. This is important