From 90feaaf2df2e0a6e38bc21b6f96a3f53b443e1f4 Mon Sep 17 00:00:00 2001 From: flow Date: Tue, 24 Jan 2023 15:44:12 -0300 Subject: [PATCH] fix(Tasks): don't try to start more tasks than necessary Signed-off-by: flow --- launcher/tasks/ConcurrentTask.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/tasks/ConcurrentTask.cpp b/launcher/tasks/ConcurrentTask.cpp index 190d48d8..3cc37b2a 100644 --- a/launcher/tasks/ConcurrentTask.cpp +++ b/launcher/tasks/ConcurrentTask.cpp @@ -115,7 +115,7 @@ void ConcurrentTask::startNext() 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(); + int num_starts = qMin(m_queue.size(), m_total_max_size - m_doing.size()); for (int i = 0; i < num_starts; i++) QMetaObject::invokeMethod(this, &ConcurrentTask::startNext, Qt::QueuedConnection); }