From f2671f417f35faa5742bdf9f24b2eb70bfeae39f Mon Sep 17 00:00:00 2001 From: Exzap <13877693+Exzap@users.noreply.github.com> Date: Wed, 25 Jan 2023 05:06:19 +0100 Subject: [PATCH] Input: Fix potential race condition Operator = for ControllerButtonState wasn't properly synchronized --- src/input/api/ControllerState.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/input/api/ControllerState.h b/src/input/api/ControllerState.h index 3e6149ab..ce79a1e0 100644 --- a/src/input/api/ControllerState.h +++ b/src/input/api/ControllerState.h @@ -102,6 +102,7 @@ struct ControllerButtonState ControllerButtonState& operator=(ControllerButtonState&& other) { cemu_assert_debug(!other.m_spinlock.is_locked()); + std::scoped_lock _l(this->m_spinlock, other.m_spinlock); this->m_pressedButtons = std::move(other.m_pressedButtons); return *this; }