From 6d2f7f6e545b2886f8219f26b3c762fd8ba2b905 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Mon, 5 Jun 2023 22:31:58 +0200 Subject: [PATCH] sys_fs: fix map entry removal in destructor --- rpcs3/Emu/Cell/lv2/sys_fs.cpp | 8 ++++---- rpcs3/Emu/Cell/lv2/sys_fs.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rpcs3/Emu/Cell/lv2/sys_fs.cpp b/rpcs3/Emu/Cell/lv2/sys_fs.cpp index 3ab168fed6..47cb6e06c6 100644 --- a/rpcs3/Emu/Cell/lv2/sys_fs.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_fs.cpp @@ -145,7 +145,7 @@ lv2_fs_mount_info_map::lv2_fs_mount_info_map() lv2_fs_mount_info_map::~lv2_fs_mount_info_map() { for (const auto& [path, info] : map) - vfs_unmount(path); + vfs_unmount(path, false); // Do not remove the value from the map we are iterating over. } bool lv2_fs_mount_info_map::remove(std::string_view path) @@ -220,7 +220,7 @@ u64 lv2_fs_mount_info_map::get_all(CellFsMountInfo* info, u64 len) const return count; } -bool lv2_fs_mount_info_map::vfs_unmount(std::string_view vpath) +bool lv2_fs_mount_info_map::vfs_unmount(std::string_view vpath, bool remove_from_map) { const std::string local_path = vfs::get(vpath); @@ -239,9 +239,9 @@ bool lv2_fs_mount_info_map::vfs_unmount(std::string_view vpath) } } - const auto result = vfs::unmount(vpath); + const bool result = vfs::unmount(vpath); - if (result) + if (result && remove_from_map) g_fxo->get().remove(vpath); return result; diff --git a/rpcs3/Emu/Cell/lv2/sys_fs.h b/rpcs3/Emu/Cell/lv2/sys_fs.h index cee72c1d82..5fb75f3d38 100644 --- a/rpcs3/Emu/Cell/lv2/sys_fs.h +++ b/rpcs3/Emu/Cell/lv2/sys_fs.h @@ -216,7 +216,7 @@ public: const lv2_fs_mount_info& lookup(std::string_view path, bool no_cell_fs_path = false) const; u64 get_all(CellFsMountInfo* info = nullptr, u64 len = 0) const; - static bool vfs_unmount(std::string_view vpath); + static bool vfs_unmount(std::string_view vpath, bool remove_from_map = true); private: std::unordered_map> map;