diff options
| author | Michael Maltese <michaeljosephmaltese@gmail.com> | 2016-10-11 12:41:29 -0700 |
|---|---|---|
| committer | Michael Maltese <michaeljosephmaltese@gmail.com> | 2016-11-30 16:07:54 -0800 |
| commit | cebb4d84f2a8021a5df2ff2a9d31eba16e1cb5e5 (patch) | |
| tree | d05fad9c0d139a5121c9d71924ad5bc5d947b617 /Source/Core/InputCommon/ControllerInterface | |
| parent | a3d2dead76f9fe46163a20f6b7cc6ac7b2b66f29 (diff) | |
ControllerInterface: clear devices before shutting down backends
The SDL backend faults if it tries to close a joystick after SDL_Quit
has been called.
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface')
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp index c6f250a157..13873ac2dd 100644 --- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp +++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp @@ -102,6 +102,19 @@ void ControllerInterface::Shutdown() if (!m_is_init) return; + { + std::lock_guard<std::mutex> lk(m_devices_mutex); + + for (const auto& d : m_devices) + { + // Set outputs to ZERO before destroying device + for (ciface::Core::Device::Output* o : d->Outputs()) + o->SetState(0); + } + + m_devices.clear(); + } + #ifdef CIFACE_USE_XINPUT ciface::XInput::DeInit(); #endif @@ -126,17 +139,6 @@ void ControllerInterface::Shutdown() ciface::evdev::Shutdown(); #endif - std::lock_guard<std::mutex> lk(m_devices_mutex); - - for (const auto& d : m_devices) - { - // Set outputs to ZERO before destroying device - for (ciface::Core::Device::Output* o : d->Outputs()) - o->SetState(0); - } - - m_devices.clear(); - m_is_init = false; } |
