fix: start at least one task in ConcurrentTask

This allows us to emit all the necessary stuff when we're finished in
the case of starting a task with no subtasks. In particular, this caused
the mod updater to not work properly :)

Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
flow 2022-09-07 12:11:42 -03:00
parent f65d506f26
commit 7cf2c3be0f
No known key found for this signature in database
GPG Key ID: 8D0F221F0A59F469

View File

@ -37,7 +37,8 @@ void ConcurrentTask::executeTask()
{ {
m_total_size = m_queue.size(); m_total_size = m_queue.size();
int num_starts = std::min(m_total_max_size, m_total_size); // Start the least amount of tasks needed, but at least one
int num_starts = std::max(1, std::min(m_total_max_size, m_total_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);
} }