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)
|
if(m_nb_wiimotes > 0)
|
||||||
{
|
{
|
||||||
// Remove all configs associated to the wiimotes (linked gamepad devices are removed automatically)
|
|
||||||
DeviceManager* device_manager = input_manager->getDeviceList();
|
DeviceManager* device_manager = input_manager->getDeviceList();
|
||||||
for(int i=0 ; i < m_nb_wiimotes ; i++)
|
|
||||||
{
|
GamePadDevice* first_gamepad_device = device_manager->getGamePadFromIrrID(WIIMOTE_START_IRR_ID);
|
||||||
int irr_id = wiimoteIdToIrrId(i);
|
assert(first_gamepad_device);
|
||||||
GamePadDevice* gamepad_device = device_manager->getGamePadFromIrrID(irr_id);
|
|
||||||
assert(gamepad_device);
|
DeviceConfig* gamepad_config = first_gamepad_device->getConfiguration();
|
||||||
|
assert(gamepad_config);
|
||||||
DeviceConfig* gamepad_config = gamepad_device->getConfiguration();
|
|
||||||
assert(gamepad_config);
|
// Remove the wiimote configuration -> automatically removes all linked gamepad devices;
|
||||||
|
device_manager->deleteConfig(gamepad_config);
|
||||||
device_manager->deleteConfig(gamepad_config);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Shut the update thread
|
// Shut the update thread
|
||||||
m_shut = true;
|
m_shut = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user