Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #10712 from tellowkrinkle/ControllerLocks
InputCommon/ControllerEmu: Use more locks
  • Loading branch information
AdmiralCurtiss committed Jul 5, 2022
2 parents de3d134 + f9c6eb7 commit 24498ca
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp
Expand Up @@ -40,6 +40,8 @@ std::unique_lock<std::recursive_mutex> EmulatedController::GetStateLock()

void EmulatedController::UpdateReferences(const ControllerInterface& devi)
{
const auto lock = GetStateLock();

m_default_device_is_connected = devi.HasConnectedDevice(m_default_device);

ciface::ExpressionParser::ControlEnvironment env(devi, GetDefaultDevice(), m_expression_vars);
Expand Down Expand Up @@ -138,6 +140,7 @@ void EmulatedController::SetDefaultDevice(ciface::Core::DeviceQualifier devq)

void EmulatedController::LoadConfig(IniFile::Section* sec, const std::string& base)
{
const auto lock = GetStateLock();
std::string defdev = GetDefaultDevice().ToString();
if (base.empty())
{
Expand All @@ -151,6 +154,7 @@ void EmulatedController::LoadConfig(IniFile::Section* sec, const std::string& ba

void EmulatedController::SaveConfig(IniFile::Section* sec, const std::string& base)
{
const auto lock = GetStateLock();
const std::string defdev = GetDefaultDevice().ToString();
if (base.empty())
sec->Set(/*std::string(" ") +*/ base + "Device", defdev, "");
Expand All @@ -161,6 +165,7 @@ void EmulatedController::SaveConfig(IniFile::Section* sec, const std::string& ba

void EmulatedController::LoadDefaults(const ControllerInterface& ciface)
{
const auto lock = GetStateLock();
// load an empty inifile section, clears everything
IniFile::Section sec;
LoadConfig(&sec);
Expand Down

0 comments on commit 24498ca

Please sign in to comment.