BGE bug fix: crash at exit when object with Radar/Near sensor has debug properties

This commit is contained in:
2008-04-19 21:15:37 +00:00
parent b0049e6088
commit bdf5c0689b
3 changed files with 14 additions and 5 deletions

View File

@@ -47,16 +47,20 @@ SCA_IScene::SCA_IScene()
{
}
SCA_IScene::~SCA_IScene()
void SCA_IScene::RemoveAllDebugProperties()
{
// release debugprop list
for (std::vector<SCA_DebugProp*>::iterator it = m_debugList.begin();
!(it==m_debugList.end());it++)
{
delete (*it);
}
m_debugList.clear();
}
SCA_IScene::~SCA_IScene()
{
RemoveAllDebugProperties();
}

View File

@@ -59,6 +59,7 @@ public:
std::vector<SCA_DebugProp*>& GetDebugProperties();
void AddDebugProperty(class CValue* debugprop,
const STR_String &name);
void RemoveAllDebugProperties();
};
#endif //__KX_ISCENE_H

View File

@@ -178,7 +178,11 @@ KX_Scene::KX_Scene(class SCA_IInputDevice* keyboarddevice,
KX_Scene::~KX_Scene()
{
// The release of debug properties used to be in SCA_IScene::~SCA_IScene
// It's still there but we remove all properties here otherwise some
// reference might be hanging and causing late release of objects
RemoveAllDebugProperties();
while (GetRootParentList()->GetCount() > 0)
{
KX_GameObject* parentobj = (KX_GameObject*) GetRootParentList()->GetValue(0);