diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp index 0cae47c741..afdf768435 100644 --- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp +++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp @@ -322,7 +322,9 @@ void ControllerInterface::UnregisterDevicesChangedCallback(const HotplugCallback // Invoke all callbacks that were registered void ControllerInterface::InvokeDevicesChangedCallbacks() const { - std::lock_guard lk(m_callbacks_mutex); - for (const auto& callback : m_devices_changed_callbacks) + m_callbacks_mutex.lock(); + const auto devices_changed_callbacks = m_devices_changed_callbacks; + m_callbacks_mutex.unlock(); + for (const auto& callback : devices_changed_callbacks) callback(); }