summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp
diff options
context:
space:
mode:
authorAdmiral H. Curtiss <pikachu025@gmail.com>2022-07-05 11:39:48 +0200
committerGitHub <noreply@github.com>2022-07-05 11:39:48 +0200
commit24498ca3159130eca123dc25ccae92781fdc3c34 (patch)
tree4a98c15c5697976c410bb82599931ef226180293 /Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp
parentde3d1344d5ed939faedae9c19e2e340a83038aba (diff)
parentf9c6eb7b9856239e8b62023de570187d304836de (diff)
Merge pull request #10712 from tellowkrinkle/ControllerLocks
InputCommon/ControllerEmu: Use more locks
Diffstat (limited to 'Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp')
-rw-r--r--Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp b/Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp
index 9cd7ced6f9..7aec56115c 100644
--- a/Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp
+++ b/Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp
@@ -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);
@@ -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())
{
@@ -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, "");
@@ -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);