Avoid creating a fileloader during shutdown.

Some silliness I found while investigating using SuperLuminal.
This commit is contained in:
Henrik Rydgård 2022-04-12 00:15:52 +02:00
parent d1e2b19ebb
commit 6de574104c
2 changed files with 11 additions and 3 deletions

View file

@ -677,9 +677,13 @@ void GameInfoCache::Clear() {
void GameInfoCache::CancelAll() {
for (auto info : info_) {
auto fl = info.second->GetFileLoader();
if (fl) {
fl->Cancel();
// GetFileLoader will create one if there isn't one already.
// Avoid that by checking.
if (info.second->HasFileLoader()) {
auto fl = info.second->GetFileLoader();
if (fl) {
fl->Cancel();
}
}
}
}

View file

@ -87,6 +87,10 @@ public:
bool DeleteAllSaveData();
bool LoadFromPath(const Path &gamePath);
bool HasFileLoader() const {
return fileLoader.get() != nullptr;
}
std::shared_ptr<FileLoader> GetFileLoader();
void DisposeFileLoader();