SDLController: Do not manually recycle controller instance

SDL_GameControllerFromInstanceID does not increase internal ref counter.
Fixes a crash when removing an SDL controller that is in use by another profile
This commit is contained in:
Exzap 2022-11-06 00:15:19 +01:00
parent ec6726e85c
commit 3df8217a02

View File

@ -58,13 +58,9 @@ bool SDLController::connect()
if (m_diid == -1) if (m_diid == -1)
return false; return false;
m_controller = SDL_GameControllerFromInstanceID(m_diid);
if (!m_controller)
{
m_controller = SDL_GameControllerOpen(index); m_controller = SDL_GameControllerOpen(index);
if (!m_controller) if (!m_controller)
return false; return false;
}
if (const char* name = SDL_GameControllerName(m_controller)) if (const char* name = SDL_GameControllerName(m_controller))
m_display_name = name; m_display_name = name;