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;