diff options
author | Kent Mein <mein@cs.umn.edu> | 2008-02-05 20:37:52 +0300 |
---|---|---|
committer | Kent Mein <mein@cs.umn.edu> | 2008-02-05 20:37:52 +0300 |
commit | e04d7128cdbcaf05bb3e0b6127eb142e525ac377 (patch) | |
tree | 4e39073d95b981381c8d27d7ac15bf3c67f34cc8 /source/gameengine/Ketsji | |
parent | 3a794a85835f35a76d3f5a8736fd7f9de26401b0 (diff) |
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
Diffstat (limited to 'source/gameengine/Ketsji')
-rw-r--r-- | source/gameengine/Ketsji/KX_Scene.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index 996c605df21..1ed429ea490 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -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); } |