More refcount errors spotted by Benoit, one with python getting a list item so scene...
authorCampbell Barton <ideasman42@gmail.com>
Sat, 9 May 2009 17:24:21 +0000 (17:24 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 9 May 2009 17:24:21 +0000 (17:24 +0000)
source/gameengine/Expressions/ListValue.cpp
source/gameengine/Ketsji/KX_BlenderMaterial.cpp

index 027d25943363e726bc02b8529a64996b82eb7b54..f4a801a965b616d4956cb9722598c53144d4d6fc 100644 (file)
@@ -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 */
index c3c738a818364d203ebf92c0ad4674b04b77a457..65a026656c50f9b34e4810e497748919ce3e1ff1 100644 (file)
@@ -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 );