From 11ee80a070ce8872fb1d2c02e388f0ae969c153a Mon Sep 17 00:00:00 2001 From: Megamouse Date: Wed, 26 Jun 2024 21:19:18 +0200 Subject: [PATCH] input: add missing lock to keyboard handler ReleaseAllKeys This should fix a segfault I encountered when closing a game. I think the consumers were removed while the window went out of focus. --- rpcs3/Emu/Io/KeyboardHandler.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rpcs3/Emu/Io/KeyboardHandler.cpp b/rpcs3/Emu/Io/KeyboardHandler.cpp index 7e70577a5b..8b2a134986 100644 --- a/rpcs3/Emu/Io/KeyboardHandler.cpp +++ b/rpcs3/Emu/Io/KeyboardHandler.cpp @@ -306,6 +306,8 @@ void keyboard_consumer::SetIntercepted(bool intercepted) void KeyboardHandlerBase::ReleaseAllKeys() { + std::lock_guard lock(m_mutex); + for (auto& [id, consumer] : m_consumers) { consumer.ReleaseAllKeys();