mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-07-02 03:16:58 +03:00
fix(ResourceFolderModel): don't read state from off-thread task
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
(cherry picked from commit 6cb07e203b)
This commit is contained in:
parent
d531abb684
commit
03de3bbe91
2 changed files with 13 additions and 6 deletions
|
|
@ -38,9 +38,12 @@ ResourceFolderModel::ResourceFolderModel(const QDir& dir, BaseInstance* instance
|
|||
m_dir.setSorting(QDir::Name | QDir::IgnoreCase | QDir::LocaleAware);
|
||||
|
||||
connect(&m_watcher, &QFileSystemWatcher::directoryChanged, this, &ResourceFolderModel::directoryChanged);
|
||||
connect(&m_helper_thread_task, &ConcurrentTask::finished, this, [this] { m_helper_thread_task.clear(); });
|
||||
connect(&m_resourceResolver, &ConcurrentTask::finished, this, [this] {
|
||||
m_resourceResolver.clear();
|
||||
m_resourceResolverRunning = false;
|
||||
});
|
||||
if (APPLICATION_DYN) { // in tests the application macro doesn't work
|
||||
m_helper_thread_task.setMaxConcurrent(APPLICATION->settings()->get("NumberOfConcurrentTasks").toInt());
|
||||
m_resourceResolver.setMaxConcurrent(APPLICATION->settings()->get("NumberOfConcurrentTasks").toInt());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -382,10 +385,11 @@ void ResourceFolderModel::resolveResource(Resource::Ptr res)
|
|||
},
|
||||
Qt::ConnectionType::QueuedConnection);
|
||||
|
||||
m_helper_thread_task.addTask(task);
|
||||
m_resourceResolver.addTask(task);
|
||||
|
||||
if (!m_helper_thread_task.isRunning()) {
|
||||
QThreadPool::globalInstance()->start(&m_helper_thread_task);
|
||||
if (!m_resourceResolverRunning) {
|
||||
QThreadPool::globalInstance()->start(&m_resourceResolver);
|
||||
m_resourceResolverRunning = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue