Fix lock guard

This commit is contained in:
Anon 2016-08-06 15:47:24 -05:00
parent 743c4647b8
commit 750838581d

View File

@ -18,9 +18,11 @@ bool Keyboard::InitDevice(int number, const std::map<std::string, std::vector<Ke
} }
void Keyboard::ProcessInput() { void Keyboard::ProcessInput() {
std::lock_guard<std::mutex> lock(m); std::map<KeyboardKey, bool> keysPressedCopy;
auto keysPressedCopy = keysPressed; {
lock.~lock_guard(); std::lock_guard<std::mutex> lock(m);
keysPressedCopy = keysPressed;
}
for (const auto &ent1 : keyMapping) { for (const auto &ent1 : keyMapping) {
int scancode = std::stoul(ent1.first, nullptr, 16); int scancode = std::stoul(ent1.first, nullptr, 16);
KeyboardKey proxy = KeyboardKey(0, scancode, ""); KeyboardKey proxy = KeyboardKey(0, scancode, "");