From 60c8c130fed60dc1fe5387b960549385188feadf Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Wed, 30 Apr 2014 18:37:47 -0700 Subject: BGE cleanup: KX_GameObject::GetParent() no longer increases the object's refcount. I'm not sure why this function ever increased the object's refcount. Any place in the code that calls KX_GameObject::GetParent() has to turn around and call parent->Release(). Forgetting to call Release() was a common cause of memory leaks (in fact, KX_SteeringActuator was probably leaking). If the refcount needs to be increased, the calling code can handle calling AddRef(). --- source/gameengine/Ketsji/KX_GameObject.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'source/gameengine/Ketsji/KX_GameObject.cpp') diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 2e39614e7d2..7042e6ed360 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -306,9 +306,6 @@ KX_GameObject* KX_GameObject::GetParent() if (node) result = (KX_GameObject*)node->GetSGClientObject(); } - - if (result) - result->AddRef(); return result; @@ -2113,7 +2110,6 @@ PyObject *KX_GameObject::pyattr_get_parent(void *self_v, const KX_PYATTRIBUTE_DE KX_GameObject* self = static_cast(self_v); KX_GameObject* parent = self->GetParent(); if (parent) { - parent->Release(); /* self->GetParent() AddRef's */ return parent->GetProxy(); } Py_RETURN_NONE; -- cgit v1.2.3