Fix wiimotes cleanup crash when several wiimotes are connected
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@12392 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
da961e2ca8
commit
3ee8b0925e
@ -319,19 +319,16 @@ void WiimoteManager::cleanup()
|
||||
{
|
||||
if(m_nb_wiimotes > 0)
|
||||
{
|
||||
// Remove all configs associated to the wiimotes (linked gamepad devices are removed automatically)
|
||||
DeviceManager* device_manager = input_manager->getDeviceList();
|
||||
for(int i=0 ; i < m_nb_wiimotes ; i++)
|
||||
{
|
||||
int irr_id = wiimoteIdToIrrId(i);
|
||||
GamePadDevice* gamepad_device = device_manager->getGamePadFromIrrID(irr_id);
|
||||
assert(gamepad_device);
|
||||
|
||||
DeviceConfig* gamepad_config = gamepad_device->getConfiguration();
|
||||
assert(gamepad_config);
|
||||
|
||||
device_manager->deleteConfig(gamepad_config);
|
||||
}
|
||||
|
||||
GamePadDevice* first_gamepad_device = device_manager->getGamePadFromIrrID(WIIMOTE_START_IRR_ID);
|
||||
assert(first_gamepad_device);
|
||||
|
||||
DeviceConfig* gamepad_config = first_gamepad_device->getConfiguration();
|
||||
assert(gamepad_config);
|
||||
|
||||
// Remove the wiimote configuration -> automatically removes all linked gamepad devices;
|
||||
device_manager->deleteConfig(gamepad_config);
|
||||
|
||||
// Shut the update thread
|
||||
m_shut = true;
|
||||
|
Loading…
Reference in New Issue
Block a user