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:
parent
ad74fedfba
commit
00d42d296e
@ -110,14 +110,14 @@ void ConcurrentTask::startNext()
|
|||||||
setStepStatus(next->isMultiStep() ? next->getStepStatus() : next->getStatus());
|
setStepStatus(next->isMultiStep() ? next->getStepStatus() : next->getStatus());
|
||||||
updateState();
|
updateState();
|
||||||
|
|
||||||
|
QCoreApplication::processEvents();
|
||||||
|
|
||||||
QMetaObject::invokeMethod(next.get(), &Task::start, Qt::QueuedConnection);
|
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.
|
// 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();
|
int num_starts = m_total_max_size - m_doing.size();
|
||||||
for (int i = 0; i < num_starts; i++)
|
for (int i = 0; i < num_starts; i++)
|
||||||
QMetaObject::invokeMethod(this, &ConcurrentTask::startNext, Qt::QueuedConnection);
|
QMetaObject::invokeMethod(this, &ConcurrentTask::startNext, Qt::QueuedConnection);
|
||||||
|
|
||||||
QCoreApplication::processEvents();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConcurrentTask::subTaskSucceeded(Task::Ptr task)
|
void ConcurrentTask::subTaskSucceeded(Task::Ptr task)
|
||||||
|
Loading…
Reference in New Issue
Block a user