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,11 +677,15 @@ void GameInfoCache::Clear() {
void GameInfoCache::CancelAll() { void GameInfoCache::CancelAll() {
for (auto info : info_) { for (auto info : info_) {
// GetFileLoader will create one if there isn't one already.
// Avoid that by checking.
if (info.second->HasFileLoader()) {
auto fl = info.second->GetFileLoader(); auto fl = info.second->GetFileLoader();
if (fl) { if (fl) {
fl->Cancel(); fl->Cancel();
} }
} }
}
} }
void GameInfoCache::FlushBGs() { void GameInfoCache::FlushBGs() {

View file

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