mirror of https://github.com/libsdl-org/SDL
Fixed race condition at startup that could cause a crash in the XInput driver
(cherry picked from commit 6d7c211faf
)
This commit is contained in:
parent
224a37faab
commit
5aadfd4eaf
|
@ -65,11 +65,13 @@ SDL_bool SDL_XINPUT_Enabled(void)
|
|||
|
||||
int SDL_XINPUT_JoystickInit(void)
|
||||
{
|
||||
s_bXInputEnabled = SDL_GetHintBoolean(SDL_HINT_XINPUT_ENABLED, SDL_TRUE);
|
||||
SDL_bool enabled = SDL_GetHintBoolean(SDL_HINT_XINPUT_ENABLED, SDL_TRUE);
|
||||
|
||||
if (s_bXInputEnabled && WIN_LoadXInputDLL() < 0) {
|
||||
s_bXInputEnabled = SDL_FALSE; /* oh well. */
|
||||
if (enabled && WIN_LoadXInputDLL() < 0) {
|
||||
enabled = SDL_FALSE; /* oh well. */
|
||||
}
|
||||
s_bXInputEnabled = enabled;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue