mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 12:51:05 +08:00
Fix crash related to keyboard / mouse disconnection on OS X (close #467)
I feel bad about this stupid mistake!
This commit is contained in:
parent
e5c6f6cd7a
commit
d77f241938
@ -53,7 +53,7 @@ bool HIDInputManager::isKeyPressed(Keyboard::Key key)
|
|||||||
// state = true if at least one corresponding HID key is pressed
|
// state = true if at least one corresponding HID key is pressed
|
||||||
bool state = false;
|
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;
|
IOHIDValueRef value = 0;
|
||||||
|
|
||||||
@ -77,6 +77,7 @@ bool HIDInputManager::isKeyPressed(Keyboard::Key key)
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
// This means the key is released
|
// 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
|
// state = true if at least one corresponding HID button is pressed
|
||||||
bool state = false;
|
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;
|
IOHIDValueRef value = 0;
|
||||||
|
|
||||||
@ -119,6 +120,7 @@ bool HIDInputManager::isMouseButtonPressed(Mouse::Button button)
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
// This means the button is released
|
// This means the button is released
|
||||||
|
++it
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user