diff options
author | DioEgizio <83089242+DioEgizio@users.noreply.github.com> | 2023-06-14 12:46:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-14 12:46:00 +0200 |
commit | a4502f44c291fad2174e84bf883cdb754aa08e28 (patch) | |
tree | 3e879eb534f8727ad29e18c40c151b6a57ec853f /launcher/tasks/ConcurrentTask.cpp | |
parent | 18c436c2bc15358e15209dfbbbc68855e8895f64 (diff) | |
parent | b3d743635c86aac583fb802c1e3c7aa25e12dc88 (diff) | |
download | PrismLauncher-a4502f44c291fad2174e84bf883cdb754aa08e28.tar.gz PrismLauncher-a4502f44c291fad2174e84bf883cdb754aa08e28.tar.bz2 PrismLauncher-a4502f44c291fad2174e84bf883cdb754aa08e28.zip |
Merge pull request #1145 from Trial97/net_job_crash
Diffstat (limited to 'launcher/tasks/ConcurrentTask.cpp')
-rw-r--r-- | launcher/tasks/ConcurrentTask.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/launcher/tasks/ConcurrentTask.cpp b/launcher/tasks/ConcurrentTask.cpp index 5ee14505..9aada5e6 100644 --- a/launcher/tasks/ConcurrentTask.cpp +++ b/launcher/tasks/ConcurrentTask.cpp @@ -138,19 +138,18 @@ void ConcurrentTask::startNext() connect(next.get(), &Task::progress, this, [this, next](qint64 current, qint64 total) { subTaskProgress(next, current, total); }); m_doing.insert(next.get(), next); + qsizetype num_starts = qMin(m_queue.size(), m_total_max_size - m_doing.size()); auto task_progress = std::make_shared<TaskStepProgress>(next->getUid()); m_task_progress.insert(next->getUid(), task_progress); updateState(); updateStepProgress(*task_progress.get(), Operation::ADDED); - 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 = 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); } |