From 2702f45cc31b24cf83f28977d50bc7c9fc1a04d7 Mon Sep 17 00:00:00 2001 From: Matt Borgerson Date: Fri, 20 Nov 2020 14:10:06 -0700 Subject: [PATCH] input: Close gamecontroller handles on disconnect --- ui/xemu-input.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ui/xemu-input.c b/ui/xemu-input.c index 2a3a27f2d9..a87a615aeb 100644 --- a/ui/xemu-input.c +++ b/ui/xemu-input.c @@ -204,7 +204,12 @@ void xemu_input_process_sdl_events(const SDL_Event *event) num_available_controllers--; // Deallocate - // FIXME: Check to release any SDL handles, etc + if (iter->sdl_haptic) { + SDL_HapticClose(iter->sdl_haptic); + } + if (iter->sdl_gamecontroller) { + SDL_GameControllerClose(iter->sdl_gamecontroller); + } free(iter); handled = 1;