refcounting bugfix, gameOb.getParent() and gameOb.parent both added a reference when they should not have.

This commit is contained in:
Campbell Barton
2009-05-09 16:29:00 +00:00
parent cf8a37a3bb
commit 5d6b249c9b

View File

@@ -1440,8 +1440,10 @@ PyObject* KX_GameObject::pyattr_get_parent(void *self_v, const KX_PYATTRIBUTE_DE
{
KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
KX_GameObject* parent = self->GetParent();
if (parent)
if (parent) {
parent->Release(); /* self->GetParent() AddRef's */
return parent->GetProxy();
}
Py_RETURN_NONE;
}
@@ -2148,8 +2150,10 @@ PyObject* KX_GameObject::PyGetParent()
{
ShowDeprecationWarning("getParent()", "the parent property");
KX_GameObject* parent = this->GetParent();
if (parent)
if (parent) {
parent->Release(); /* self->GetParent() AddRef's */
return parent->GetProxy();
}
Py_RETURN_NONE;
}