Skip to content
Permalink
Browse files

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.
  • Loading branch information...
CookiePLMonster committed Oct 8, 2019
1 parent 5e7b95d commit cc6ffef4a1d5d643dfb3542adf8bc4b3b4dcaef1
Showing with 8 additions and 5 deletions.
  1. +6 −4 Source/Core/DolphinQt/GameList/GameTracker.cpp
  2. +2 −1 Source/Core/DolphinQt/GameList/GameTracker.h
@@ -79,6 +79,11 @@ GameTracker::GameTracker(QObject* parent) : QFileSystemWatcher(parent)
case CommandType::PurgeCache:
m_cache.Clear(UICommon::GameFileCache::DeleteOnDisk::Yes);
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()
{
for (auto& file : m_tracked_files.keys())
emit GameRemoved(file.toStdString());

m_tracked_files.clear();
m_load_thread.EmplaceItem(Command{CommandType::BeginRefresh});

for (const QString& dir : Settings::Instance().GetPaths())
{
@@ -72,7 +72,8 @@ class GameTracker final : public QFileSystemWatcher
UpdateDirectory,
UpdateFile,
UpdateMetadata,
PurgeCache
PurgeCache,
BeginRefresh,
};

struct Command

0 comments on commit cc6ffef

Please sign in to comment.
You can’t perform that action at this time.