fix: call processEvents() before adding new tasks to the task queue

This allows the ongoing task to go off the stack before the next one is
started.

Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
flow 2023-01-17 16:08:50 -03:00
parent ad74fedfba
commit 00d42d296e
No known key found for this signature in database
GPG Key ID: 8D0F221F0A59F469

View File

@ -110,14 +110,14 @@ void ConcurrentTask::startNext()
setStepStatus(next->isMultiStep() ? next->getStepStatus() : next->getStatus());
updateState();
QCoreApplication::processEvents();
QMetaObject::invokeMethod(next.get(), &Task::start, Qt::QueuedConnection);
// Allow going up the number of concurrent tasks in case of tasks being added in the middle of a running task.
int num_starts = m_total_max_size - m_doing.size();
for (int i = 0; i < num_starts; i++)
QMetaObject::invokeMethod(this, &ConcurrentTask::startNext, Qt::QueuedConnection);
QCoreApplication::processEvents();
}
void ConcurrentTask::subTaskSucceeded(Task::Ptr task)