Fix mutex logic for cancelling operations.

This commit is contained in:
Andrius Štikonas 2018-03-31 20:17:43 +01:00
parent 8658743a49
commit c1f4b36305
1 changed files with 1 additions and 8 deletions

View File

@ -73,9 +73,9 @@ void OperationRunner::run()
for (int i = 0; i < numOperations(); i++) { for (int i = 0; i < numOperations(); i++) {
suspendMutex().lock(); suspendMutex().lock();
suspendMutex().unlock();
if (!status || isCancelling()) { if (!status || isCancelling()) {
suspendMutex().unlock();
break; break;
} }
@ -92,13 +92,6 @@ void OperationRunner::run()
disconnect(op, &Operation::progress, this, &OperationRunner::progressSub); disconnect(op, &Operation::progress, this, &OperationRunner::progressSub);
emit opFinished(i + 1, op); emit opFinished(i + 1, op);
suspendMutex().unlock();
// Sleep a little to give others a chance to suspend us. This should normally not be
// required -- is it possible that the compiler just optimizes our unlock/lock away
// if we don't sleep?
msleep(5);
} }
if (automounter) if (automounter)