forked from bartvdbraak/blender
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.
This commit is contained in:
parent
b90de0331d
commit
be114086f2
@ -567,11 +567,16 @@ KX_GameObject* KX_Scene::AddNodeReplicaObject(class SG_IObject* node, class CVal
|
|||||||
{
|
{
|
||||||
PHY_IMotionState* motionstate = new KX_MotionState(newobj->GetSGNode());
|
PHY_IMotionState* motionstate = new KX_MotionState(newobj->GetSGNode());
|
||||||
PHY_IPhysicsController* newctrl = orgobj->GetPhysicsController()->GetReplica();
|
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());
|
newctrl->SetNewClientInfo(newobj->getClientInfo());
|
||||||
newobj->SetPhysicsController(newctrl, newobj->IsDynamic());
|
newobj->SetPhysicsController(newctrl, newobj->IsDynamic());
|
||||||
newctrl->PostProcessReplica(motionstate, parentctrl);
|
newctrl->PostProcessReplica(motionstate, parentctrl);
|
||||||
|
|
||||||
|
if (parent)
|
||||||
|
parent->Release();
|
||||||
}
|
}
|
||||||
return newobj;
|
return newobj;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user