Fixed race condition at startup that could cause a crash in the XInput driver
This commit is contained in:
@@ -46,11 +46,13 @@ bool SDL_XINPUT_Enabled(void)
|
|||||||
|
|
||||||
bool SDL_XINPUT_JoystickInit(void)
|
bool SDL_XINPUT_JoystickInit(void)
|
||||||
{
|
{
|
||||||
s_bXInputEnabled = SDL_GetHintBoolean(SDL_HINT_XINPUT_ENABLED, true);
|
bool enabled = SDL_GetHintBoolean(SDL_HINT_XINPUT_ENABLED, true);
|
||||||
|
|
||||||
if (s_bXInputEnabled && !WIN_LoadXInputDLL()) {
|
if (enabled && !WIN_LoadXInputDLL()) {
|
||||||
s_bXInputEnabled = false; // oh well.
|
enabled = false; // oh well.
|
||||||
}
|
}
|
||||||
|
s_bXInputEnabled = enabled;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,7 +220,7 @@ void SDL_XINPUT_JoystickDetect(JoyStick_DeviceData **pContext)
|
|||||||
{
|
{
|
||||||
int iuserid;
|
int iuserid;
|
||||||
|
|
||||||
if (!s_bXInputEnabled || !XINPUTGETCAPABILITIES) {
|
if (!s_bXInputEnabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user