From d77f2419383619506fba36b7d6ab93f96e86127f Mon Sep 17 00:00:00 2001 From: Marco Antognini Date: Fri, 20 Sep 2013 21:50:46 +0200 Subject: [PATCH] Fix crash related to keyboard / mouse disconnection on OS X (close #467) I feel bad about this stupid mistake! --- src/SFML/Window/OSX/HIDInputManager.mm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/SFML/Window/OSX/HIDInputManager.mm b/src/SFML/Window/OSX/HIDInputManager.mm index d1c4d169e..1d112e1c4 100644 --- a/src/SFML/Window/OSX/HIDInputManager.mm +++ b/src/SFML/Window/OSX/HIDInputManager.mm @@ -53,7 +53,7 @@ bool HIDInputManager::isKeyPressed(Keyboard::Key key) // state = true if at least one corresponding HID key is pressed bool state = false; - for (IOHIDElements::iterator it = m_keys[key].begin(); it != m_keys[key].end(); ++it) { + for (IOHIDElements::iterator it = m_keys[key].begin(); it != m_keys[key].end();) { IOHIDValueRef value = 0; @@ -77,6 +77,7 @@ bool HIDInputManager::isKeyPressed(Keyboard::Key key) } else { // This means the key is released + ++it; } } @@ -95,7 +96,7 @@ bool HIDInputManager::isMouseButtonPressed(Mouse::Button button) // state = true if at least one corresponding HID button is pressed bool state = false; - for (IOHIDElements::iterator it = m_buttons[button].begin(); it != m_buttons[button].end(); ++it) { + for (IOHIDElements::iterator it = m_buttons[button].begin(); it != m_buttons[button].end();) { IOHIDValueRef value = 0; @@ -119,6 +120,7 @@ bool HIDInputManager::isMouseButtonPressed(Mouse::Button button) } else { // This means the button is released + ++it } }