diff --git a/Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp b/Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp index 7aec56115c..0a3de3e391 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp +++ b/Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp @@ -40,7 +40,7 @@ std::unique_lock EmulatedController::GetStateLock() void EmulatedController::UpdateReferences(const ControllerInterface& devi) { - const auto lock = GetStateLock(); + std::scoped_lock lk(s_get_state_mutex, devi.GetDevicesMutex()); m_default_device_is_connected = devi.HasConnectedDevice(m_default_device); diff --git a/Source/Core/InputCommon/ControllerInterface/CoreDevice.h b/Source/Core/InputCommon/ControllerInterface/CoreDevice.h index 227a1febbe..2280ddac3b 100644 --- a/Source/Core/InputCommon/ControllerInterface/CoreDevice.h +++ b/Source/Core/InputCommon/ControllerInterface/CoreDevice.h @@ -238,6 +238,8 @@ public: std::chrono::milliseconds confirmation_wait, std::chrono::milliseconds maximum_wait) const; + std::recursive_mutex& GetDevicesMutex() const { return m_devices_mutex; } + protected: // Exclusively needed when reading/writing "m_devices" mutable std::recursive_mutex m_devices_mutex;