diff options
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/SDL')
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp index 870f0387d7..a31abd3055 100644 --- a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp +++ b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp @@ -58,12 +58,10 @@ void Init() SDL_Joystick* dev = SDL_JoystickOpen(i); if (dev) { - Joystick* js = new Joystick(dev, i, name_counts[GetJoystickName(i)]++); + auto js = std::make_shared<Joystick>(dev, i, name_counts[GetJoystickName(i)]++); // only add if it has some inputs/outputs if (js->Inputs().size() || js->Outputs().size()) - g_controller_interface.AddDevice(js); - else - delete js; + g_controller_interface.AddDevice(std::move(js)); } } } |
