input: fix deadlock in adding gamepad input src

mp_input_sdl_gamepad_add() calls mp_input_add_thread_src() which
already locks, so it cannot be called inside a lock.

Missed in e8b9476bf7 refactoring.
This commit is contained in:
nanahi 2024-04-19 00:49:28 -04:00 committed by sfan5
parent 1a495451ab
commit 5109c599db
1 changed files with 8 additions and 6 deletions

View File

@ -1414,13 +1414,15 @@ void mp_input_load_config(struct input_ctx *ictx)
talloc_free(tmp);
}
#if HAVE_SDL2_GAMEPAD
if (ictx->opts->use_gamepad) {
mp_input_sdl_gamepad_add(ictx);
}
#endif
bool use_gamepad = ictx->opts->use_gamepad;
input_unlock(ictx);
#if HAVE_SDL2_GAMEPAD
if (use_gamepad)
mp_input_sdl_gamepad_add(ictx);
#else
(void)use_gamepad;
#endif
}
bool mp_input_load_config_file(struct input_ctx *ictx, char *file)