mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-08-08 01:00:11 +00:00
sys_fs: fix map entry removal in destructor
This commit is contained in:
parent
a131a41874
commit
6d2f7f6e54
2 changed files with 5 additions and 5 deletions
|
@ -145,7 +145,7 @@ lv2_fs_mount_info_map::lv2_fs_mount_info_map()
|
||||||
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)
|
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)
|
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;
|
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);
|
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<lv2_fs_mount_info_map>().remove(vpath);
|
g_fxo->get<lv2_fs_mount_info_map>().remove(vpath);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -216,7 +216,7 @@ public:
|
||||||
const lv2_fs_mount_info& lookup(std::string_view path, bool no_cell_fs_path = false) const;
|
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;
|
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:
|
private:
|
||||||
std::unordered_map<std::string, lv2_fs_mount_info, fmt::string_hash, std::equal_to<>> map;
|
std::unordered_map<std::string, lv2_fs_mount_info, fmt::string_hash, std::equal_to<>> map;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue