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::map<KeyboardKey, bool> keysPressedCopy;
{
std::lock_guard<std::mutex> lock(m); std::lock_guard<std::mutex> lock(m);
auto keysPressedCopy = keysPressed; keysPressedCopy = keysPressed;
lock.~lock_guard(); }
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, "");