Qt: Cancel existing BIOS search on refresh

Stops lockups if you set a large directory.
This commit is contained in:
Stenzek 2023-09-09 14:43:22 +10:00 committed by Connor McLaughlin
parent d9587e20c0
commit b601c49f6c
1 changed files with 4 additions and 0 deletions

View File

@ -65,6 +65,7 @@ void BIOSSettingsWidget::refreshList()
{ {
if (m_refresh_thread) if (m_refresh_thread)
{ {
m_refresh_thread->requestInterruption();
m_refresh_thread->wait(); m_refresh_thread->wait();
delete m_refresh_thread; delete m_refresh_thread;
} }
@ -176,6 +177,9 @@ void BIOSSettingsWidget::RefreshThread::run()
{ {
for (const QFileInfo& info : dir.entryInfoList(QDir::Files)) for (const QFileInfo& info : dir.entryInfoList(QDir::Files))
{ {
if (isInterruptionRequested())
break;
BIOSInfo bi; BIOSInfo bi;
QString full_path(info.absoluteFilePath()); QString full_path(info.absoluteFilePath());
if (!IsBIOS(full_path.toUtf8().constData(), bi.version, bi.description, bi.region, bi.zone)) if (!IsBIOS(full_path.toUtf8().constData(), bi.version, bi.description, bi.region, bi.zone))