Created
October 7, 2016 23:45
-
-
Save invisiblek/6a0196dcf71643034d0e9ba3f36895ea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/xbmc/input/SDLJoystick.cpp b/xbmc/input/SDLJoystick.cpp | |
index b1e71e1..757effda 100644 | |
--- a/xbmc/input/SDLJoystick.cpp | |
+++ b/xbmc/input/SDLJoystick.cpp | |
@@ -391,6 +391,7 @@ float CJoystick::SetDeadzone(float val) | |
bool CJoystick::ReleaseJoysticks() | |
{ | |
+ int count = 0; | |
// close open joysticks | |
for (std::map<int, SDL_Joystick*>::const_iterator it = m_Joysticks.begin(); it != m_Joysticks.end(); ++it) | |
SDL_JoystickClose(it->second); | |
@@ -399,8 +400,14 @@ bool CJoystick::ReleaseJoysticks() | |
Reset(); | |
// Restart SDL joystick subsystem | |
- SDL_QuitSubSystem(SDL_INIT_JOYSTICK); | |
- if (SDL_WasInit(SDL_INIT_JOYSTICK) != 0) | |
+ while (SDL_WasInit(SDL_INIT_JOYSTICK) != 0 && count < 10) | |
+ { | |
+ SDL_QuitSubSystem(SDL_INIT_JOYSTICK); | |
+ sleep(1); | |
+ count++; | |
+ } | |
+ | |
+ if (count == 10) | |
{ | |
CLog::Log(LOGERROR, "Stop joystick subsystem failed"); | |
return false; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment