diff options
author | Mitchell Stokes <mogurijin@gmail.com> | 2013-11-04 23:22:52 +0400 |
---|---|---|
committer | Mitchell Stokes <mogurijin@gmail.com> | 2013-11-04 23:22:52 +0400 |
commit | be114086f223345f97f033dd9350a918dbb0eec5 (patch) | |
tree | 3ff7ee3b2cdd3f05c691329b9115d66f5e8714b0 /source/gameengine/Ketsji/KX_Scene.cpp | |
parent | b90de0331df6c92af909b20a3e183596ff3511e4 (diff) |
BGE: The recent physics cleanup was using KX_GameObject::GetParent() with out calling parent->Release(). Since GetParent() does an AddRef(), this was causing a leak, which resulted in Zombie Object errors.
Diffstat (limited to 'source/gameengine/Ketsji/KX_Scene.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_Scene.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index 1d95beed6e9..2cddb073b41 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -567,11 +567,16 @@ KX_GameObject* KX_Scene::AddNodeReplicaObject(class SG_IObject* node, class CVal { PHY_IMotionState* motionstate = new KX_MotionState(newobj->GetSGNode()); PHY_IPhysicsController* newctrl = orgobj->GetPhysicsController()->GetReplica(); - PHY_IPhysicsController* parentctrl = (newobj->GetParent()) ? newobj->GetParent()->GetPhysicsController() : NULL; + + KX_GameObject *parent = newobj->GetParent(); + PHY_IPhysicsController* parentctrl = (parent) ? parent->GetPhysicsController() : NULL; newctrl->SetNewClientInfo(newobj->getClientInfo()); newobj->SetPhysicsController(newctrl, newobj->IsDynamic()); newctrl->PostProcessReplica(motionstate, parentctrl); + + if (parent) + parent->Release(); } return newobj; } |