mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-03 08:28:29 +00:00
Fixed memory leak if joysticks were initialized but gamepads were not
If a joystick is connected, SDL_IsGamepad() will be called on it, which adds it to the cache, which then needs to be cleaned up when joysticks quit.
This commit is contained in:
@@ -3686,11 +3686,6 @@ void SDL_QuitGamepads(void)
|
|||||||
SDL_CloseGamepad(SDL_gamepads);
|
SDL_CloseGamepad(SDL_gamepads);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s_gamepadInstanceIDs) {
|
|
||||||
SDL_DestroyHashTable(s_gamepadInstanceIDs);
|
|
||||||
s_gamepadInstanceIDs = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_UnlockJoysticks();
|
SDL_UnlockJoysticks();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3710,6 +3705,11 @@ void SDL_QuitGamepadMappings(void)
|
|||||||
|
|
||||||
SDL_FreeVIDPIDList(&SDL_allowed_gamepads);
|
SDL_FreeVIDPIDList(&SDL_allowed_gamepads);
|
||||||
SDL_FreeVIDPIDList(&SDL_ignored_gamepads);
|
SDL_FreeVIDPIDList(&SDL_ignored_gamepads);
|
||||||
|
|
||||||
|
if (s_gamepadInstanceIDs) {
|
||||||
|
SDL_DestroyHashTable(s_gamepadInstanceIDs);
|
||||||
|
s_gamepadInstanceIDs = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user