This is patch [#8232] Memory leak in KX_Scene destructor fixed

Submitted By: Benoit Bolsee (ben2610)

Fixes a loop so that it removes objects properly from the scene.

Kent
This commit is contained in:
Kent Mein
2008-02-05 17:37:52 +00:00
parent 3a794a8583
commit e04d7128cd

View File

@@ -171,12 +171,9 @@ KX_Scene::KX_Scene(class SCA_IInputDevice* keyboarddevice,
KX_Scene::~KX_Scene()
{
// int numobj = m_objectlist->GetCount();
//int numrootobjects = GetRootParentList()->GetCount();
for (int i = 0; i < GetRootParentList()->GetCount(); i++)
while (GetRootParentList()->GetCount() > 0)
{
KX_GameObject* parentobj = (KX_GameObject*) GetRootParentList()->GetValue(i);
KX_GameObject* parentobj = (KX_GameObject*) GetRootParentList()->GetValue(0);
this->RemoveObject(parentobj);
}