mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-30 15:32:47 +00:00
Add CommandType::BeginRefresh
This resolves a race condition when spamming Refresh button, which would often end up with duplicates game entries for the entire duration of the session.
This commit is contained in:
parent
5e7b95db3b
commit
cc6ffef4a1
@ -79,6 +79,11 @@ GameTracker::GameTracker(QObject* parent) : QFileSystemWatcher(parent)
|
|||||||
case CommandType::PurgeCache:
|
case CommandType::PurgeCache:
|
||||||
m_cache.Clear(UICommon::GameFileCache::DeleteOnDisk::Yes);
|
m_cache.Clear(UICommon::GameFileCache::DeleteOnDisk::Yes);
|
||||||
break;
|
break;
|
||||||
|
case CommandType::BeginRefresh:
|
||||||
|
for (auto& file : m_tracked_files.keys())
|
||||||
|
emit GameRemoved(file.toStdString());
|
||||||
|
m_tracked_files.clear();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -177,10 +182,7 @@ void GameTracker::RemoveDirectory(const QString& dir)
|
|||||||
|
|
||||||
void GameTracker::RefreshAll()
|
void GameTracker::RefreshAll()
|
||||||
{
|
{
|
||||||
for (auto& file : m_tracked_files.keys())
|
m_load_thread.EmplaceItem(Command{CommandType::BeginRefresh});
|
||||||
emit GameRemoved(file.toStdString());
|
|
||||||
|
|
||||||
m_tracked_files.clear();
|
|
||||||
|
|
||||||
for (const QString& dir : Settings::Instance().GetPaths())
|
for (const QString& dir : Settings::Instance().GetPaths())
|
||||||
{
|
{
|
||||||
|
@ -72,7 +72,8 @@ private:
|
|||||||
UpdateDirectory,
|
UpdateDirectory,
|
||||||
UpdateFile,
|
UpdateFile,
|
||||||
UpdateMetadata,
|
UpdateMetadata,
|
||||||
PurgeCache
|
PurgeCache,
|
||||||
|
BeginRefresh,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Command
|
struct Command
|
||||||
|
Loading…
x
Reference in New Issue
Block a user