diff --git a/Core/FileSystems/MetaFileSystem.cpp b/Core/FileSystems/MetaFileSystem.cpp index 8fba8dff00..adc86c0ebb 100644 --- a/Core/FileSystems/MetaFileSystem.cpp +++ b/Core/FileSystems/MetaFileSystem.cpp @@ -292,12 +292,14 @@ void MetaFileSystem::Mount(const std::string &prefix, std::shared_ptr guard(lock); for (auto iter = fileSystems.begin(); iter != fileSystems.end(); iter++) { if (iter->prefix == prefix) { fileSystems.erase(iter); @@ -325,6 +327,7 @@ IFileSystem *MetaFileSystem::GetSystemFromFilename(const std::string &filename) } IFileSystem *MetaFileSystem::GetSystem(const std::string &prefix) { + std::lock_guard guard(lock); for (auto it = fileSystems.begin(); it != fileSystems.end(); ++it) { if (it->prefix == NormalizePrefix(prefix)) return it->system.get(); diff --git a/Core/FileSystems/MetaFileSystem.h b/Core/FileSystems/MetaFileSystem.h index a735106f68..0a2255566f 100644 --- a/Core/FileSystems/MetaFileSystem.h +++ b/Core/FileSystems/MetaFileSystem.h @@ -43,8 +43,9 @@ private: currentDir_t currentDir; std::string startingDirectory; - std::recursive_mutex lock; // must be recursive + std::recursive_mutex lock; // must be recursive. TODO: fix that + // Assumes the lock is held void Reset() { // This used to be 6, probably an attempt to replicate PSP handles. // However, that's an artifact of using psplink anyway...