From db4b25a0b48ca8c2f7c0d8b4c071637873e818f7 Mon Sep 17 00:00:00 2001 From: Ryo Suzuki Date: Thu, 25 Apr 2024 11:48:26 +0900 Subject: [PATCH] [Windows] fix #1221 --- .../Siv3D-Platform/WindowsDesktop/Siv3D/Keyboard/CKeyboard.cpp | 2 ++ .../Siv3D-Platform/WindowsDesktop/Siv3D/Keyboard/CKeyboard.hpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Siv3D/src/Siv3D-Platform/WindowsDesktop/Siv3D/Keyboard/CKeyboard.cpp b/Siv3D/src/Siv3D-Platform/WindowsDesktop/Siv3D/Keyboard/CKeyboard.cpp index 8d3c9b3b8..1f5b59895 100644 --- a/Siv3D/src/Siv3D-Platform/WindowsDesktop/Siv3D/Keyboard/CKeyboard.cpp +++ b/Siv3D/src/Siv3D-Platform/WindowsDesktop/Siv3D/Keyboard/CKeyboard.cpp @@ -214,6 +214,8 @@ namespace s3d Array CKeyboard::getEvents() const noexcept { + std::lock_guard lock{ m_eventMutex }; + return m_events; } diff --git a/Siv3D/src/Siv3D-Platform/WindowsDesktop/Siv3D/Keyboard/CKeyboard.hpp b/Siv3D/src/Siv3D-Platform/WindowsDesktop/Siv3D/Keyboard/CKeyboard.hpp index ad618a3e6..40a17c78e 100644 --- a/Siv3D/src/Siv3D-Platform/WindowsDesktop/Siv3D/Keyboard/CKeyboard.hpp +++ b/Siv3D/src/Siv3D-Platform/WindowsDesktop/Siv3D/Keyboard/CKeyboard.hpp @@ -62,7 +62,7 @@ namespace s3d ////// // - std::mutex m_eventMutex; + mutable std::mutex m_eventMutex; uint32 m_eventIndex = 0;