Fix deadlock in games_config

This commit is contained in:
RipleyTom 2023-05-02 03:04:34 +02:00 committed by Megamouse
parent ea3a73b598
commit bf190fd3d8
2 changed files with 9 additions and 4 deletions

View file

@ -66,7 +66,7 @@ bool games_config::add_game(const std::string& key, const std::string& path)
if (m_save_on_dirty)
{
return save();
return save_nl();
}
return true;
@ -90,10 +90,8 @@ bool games_config::add_external_hdd_game(const std::string& key, std::string& pa
return false;
}
bool games_config::save()
bool games_config::save_nl()
{
std::lock_guard lock(m_mutex);
YAML::Emitter out;
out << m_games;
@ -109,6 +107,12 @@ bool games_config::save()
return false;
}
bool games_config::save()
{
std::lock_guard lock(m_mutex);
return save_nl();
}
void games_config::load()
{
std::lock_guard lock(m_mutex);

View file

@ -21,6 +21,7 @@ public:
bool save();
private:
bool save_nl();
void load();
std::map<std::string, std::string> m_games;