forked from bartvdbraak/blender
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:
parent
4d1d60e236
commit
9b9359120f
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user