Lock joysticks when adding gamepad mappings

Fixes https://github.com/libsdl-org/SDL/issues/8412
main
Sam Lantinga 2023-10-19 22:35:53 -07:00
parent 76f81797b7
commit 70fd8e2ba2
1 changed files with 4 additions and 0 deletions

View File

@ -1670,6 +1670,8 @@ int SDL_AddGamepadMappingsFromRW(SDL_RWops *src, SDL_bool freesrc)
}
line = buf;
SDL_LockJoysticks();
PushMappingChangeTracking();
while (line < buf + db_size) {
@ -1702,6 +1704,8 @@ int SDL_AddGamepadMappingsFromRW(SDL_RWops *src, SDL_bool freesrc)
PopMappingChangeTracking();
SDL_UnlockJoysticks();
SDL_free(buf);
return gamepads;
}