ControllerInterface: clear devices before shutting down backends
The SDL backend faults if it tries to close a joystick after SDL_Quit has been called.
This commit is contained in:
parent
a3d2dead76
commit
cebb4d84f2
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue