summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2021-11-23 16:27:03 +0100
committerGitHub <noreply@github.com>2021-11-23 16:27:03 +0100
commite1e3db13baabefa89991388d37db0bb260c4f535 (patch)
tree49e2d9520c09b08e9cc5b0013c9f991687554900 /Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp
parentba62019eb5fa2f207821a8cfd9610533d12313e6 (diff)
parent1badceb455dae28a93a51da6c5cda0b510f93701 (diff)
Merge pull request #10228 from Filoppi/fix_android_input_deadlock
ControllerInterface: fix UpdateReferences() deadlock
Diffstat (limited to 'Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp')
-rw-r--r--Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp b/Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp
index c804e303f2..9cd7ced6f9 100644
--- a/Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp
+++ b/Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp
@@ -18,6 +18,8 @@
namespace ControllerEmu
{
+// This should theoretically be per EmulatedController instance,
+// though no EmulatedController usually run in parallel, so it makes little difference
static std::recursive_mutex s_get_state_mutex;
std::string EmulatedController::GetDisplayName() const
@@ -77,6 +79,7 @@ void EmulatedController::UpdateSingleControlReference(const ControllerInterface&
{
ciface::ExpressionParser::ControlEnvironment env(devi, GetDefaultDevice(), m_expression_vars);
+ const auto lock = GetStateLock();
ref->UpdateReference(env);
env.CleanUnusedVariables();