BGE bug: fix a crash at game exit caused by inconsistent controller map after object deletion. The bug became apparent since the memory leaks have been fixed.

This commit is contained in:
Benoit Bolsee 2008-04-24 21:26:39 +00:00
parent 4d1d60e236
commit 9b9359120f
2 changed files with 9 additions and 0 deletions

@ -174,6 +174,14 @@ void SCA_LogicManager::RemoveSensor(SCA_ISensor* sensor)
}
}
void SCA_LogicManager::RemoveController(SCA_IController* controller)
{
std::map<SCA_ISensor*,controllerlist>::iterator sit;
for (sit = m_sensorcontrollermapje.begin();!(sit==m_sensorcontrollermapje.end());++sit)
{
(*sit).second.remove(controller);
}
}
void SCA_LogicManager::RemoveDestroyedActuator(SCA_IActuator* actuator)

@ -754,6 +754,7 @@ int KX_Scene::NewRemoveObject(class CValue* gameobj)
{
(*itc)->UnlinkAllSensors();
(*itc)->UnlinkAllActuators();
m_logicmgr->RemoveController(*itc);
}
SCA_ActuatorList& actuators = newobj->GetActuators();