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

View file

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