From 7062967b5b50cf57bc7f3d11741ff0dd893c4ee0 Mon Sep 17 00:00:00 2001 From: Michael M Date: Thu, 9 Nov 2017 14:04:31 -0800 Subject: SDLJoystick: store name on creation Otherwise, Dolphin will crash when the joystick is removed. --- Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp') diff --git a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp index 7da8e66fc6..e17c307d1d 100644 --- a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp +++ b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp @@ -69,7 +69,7 @@ void PopulateDevices() } Joystick::Joystick(SDL_Joystick* const joystick, const int sdl_index) - : m_joystick(joystick), m_sdl_index(sdl_index) + : m_joystick(joystick), m_name(StripSpaces(GetJoystickName(sdl_index))) { // really bad HACKS: // to not use SDL for an XInput device @@ -284,7 +284,7 @@ void Joystick::UpdateInput() std::string Joystick::GetName() const { - return StripSpaces(GetJoystickName(m_sdl_index)); + return m_name; } std::string Joystick::GetSource() const -- cgit v1.2.3