Skip to content

Commit 3df8217

Browse files
committed
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
1 parent ec6726e commit 3df8217

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/input/api/SDL/SDLController.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,9 @@ bool SDLController::connect()
5858
if (m_diid == -1)
5959
return false;
6060

61-
m_controller = SDL_GameControllerFromInstanceID(m_diid);
61+
m_controller = SDL_GameControllerOpen(index);
6262
if (!m_controller)
63-
{
64-
m_controller = SDL_GameControllerOpen(index);
65-
if (!m_controller)
66-
return false;
67-
}
63+
return false;
6864

6965
if (const char* name = SDL_GameControllerName(m_controller))
7066
m_display_name = name;

0 commit comments

Comments
 (0)