diff options
author | flow <flowlnlnln@gmail.com> | 2023-01-24 15:44:12 -0300 |
---|---|---|
committer | flow <flowlnlnln@gmail.com> | 2023-01-24 17:04:05 -0300 |
commit | 90feaaf2df2e0a6e38bc21b6f96a3f53b443e1f4 (patch) | |
tree | ae5c529ae397e828bfcea007d9986a9b6f90cd97 | |
parent | 6d27ef5eeada43853b55a591921c8d5a78d537c9 (diff) | |
download | PrismLauncher-90feaaf2df2e0a6e38bc21b6f96a3f53b443e1f4.tar.gz PrismLauncher-90feaaf2df2e0a6e38bc21b6f96a3f53b443e1f4.tar.bz2 PrismLauncher-90feaaf2df2e0a6e38bc21b6f96a3f53b443e1f4.zip |
fix(Tasks): don't try to start more tasks than necessary
Signed-off-by: flow <flowlnlnln@gmail.com>
-rw-r--r-- | launcher/tasks/ConcurrentTask.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
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); } |