Skip to content

Commit

Permalink
Fixed race condition at startup that could cause a crash in the XInpu…
Browse files Browse the repository at this point in the history
…t driver

(cherry picked from commit 6d7c211)
(cherry picked from commit 5aadfd4)
  • Loading branch information
slouken committed Sep 6, 2024
1 parent e5bb4fa commit d53b22e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/joystick/windows/SDL_xinputjoystick.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit d53b22e

Please sign in to comment.