diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-05-09 21:24:21 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-05-09 21:24:21 +0400 |
commit | 355b585447040e7f5697e4ee8adb951ca2aea4d3 (patch) | |
tree | f718aed96082e5167bfe07afa199a84d73da3684 | |
parent | cfc21667b98e1be9ba8ebabbd19a75541585ad24 (diff) |
More refcount errors spotted by Benoit, one with python getting a list item so scene.objects["OBfoo"] would always mess up refcounts.
-rw-r--r-- | source/gameengine/Expressions/ListValue.cpp | 8 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_BlenderMaterial.cpp | 1 |
2 files changed, 6 insertions, 3 deletions
diff --git a/source/gameengine/Expressions/ListValue.cpp b/source/gameengine/Expressions/ListValue.cpp index 027d2594336..f4a801a965b 100644 --- a/source/gameengine/Expressions/ListValue.cpp +++ b/source/gameengine/Expressions/ListValue.cpp @@ -78,13 +78,15 @@ PyObject* listvalue_mapping_subscript(PyObject* self, PyObject* pyindex) STR_String index(PyString_AsString(pyindex)); CValue *item = ((CListValue*) list)->FindValue(index); if (item) + { + item->Release(); /* FindValue() AddRef's */ return item->GetProxy(); - + } } - if (PyInt_Check(pyindex)) + else if (PyInt_Check(pyindex)) { int index = PyInt_AsLong(pyindex); - return listvalue_buffer_item(self, index); + return listvalue_buffer_item(self, index); /* wont add a ref */ } PyObject *pyindex_str = PyObject_Repr(pyindex); /* new ref */ diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp index c3c738a8183..65a026656c5 100644 --- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp +++ b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp @@ -715,6 +715,7 @@ void KX_BlenderMaterial::setObjectMatrixData(int i, RAS_IRasterizer *ras) mScene->GetObjectList()->FindValue(mMaterial->mapping[i].objconame); if(!obj) return; + obj->Release(); /* FindValue() AddRef's */ glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR ); glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR ); |