More refcount errors spotted by Benoit, one with python getting a list item so scene.objects["OBfoo"] would always mess up refcounts.

This commit is contained in:
Campbell Barton 2009-05-09 17:24:21 +00:00
parent cfc21667b9
commit 355b585447
2 changed files with 6 additions and 3 deletions

@ -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 */

@ -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 );