BGE VideoTexture: fix bug with VideoTexture.materialID() since recent commit.
authorBenoit Bolsee <benoit.bolsee@online.be>
Mon, 20 Apr 2009 21:20:33 +0000 (21:20 +0000)
committerBenoit Bolsee <benoit.bolsee@online.be>
Mon, 20 Apr 2009 21:20:33 +0000 (21:20 +0000)
source/gameengine/VideoTexture/BlendType.h
source/gameengine/VideoTexture/Texture.cpp

index ac3ed8812a6d1e8b62ca61a8e5f0d6b759294367..8b243c439129d96d4ae5a6e6c58ea9dd5d2f4352 100644 (file)
@@ -25,6 +25,7 @@ http://www.gnu.org/copyleft/lesser.txt.
 
 
 /// class allows check type of blender python object and access its contained object
+/// MUST ONLY BE USED FOR KX classes that are descendent of PyObjectPlus
 template <class PyObj> class BlendType
 {
 public:
@@ -48,8 +49,9 @@ public:
                // if pointer to type is set and don't match to type of provided object, return NULL
                else if (obj->ob_type != m_objType) 
                        return NULL;
-               // return pointer to object
-               return (PyObj*)obj;
+               // return pointer to object, this class can only be used for KX object =>
+               // the Py object is actually a proxy
+               return (PyObj*)BGE_PROXY_REF(obj);
        }
 
        /// parse arguments to get object
index 66c67023e38b5ec64ea5771567cc0a953d44265f..fa941f9260ed080d5ca325a22e9f0eaff64812b0 100644 (file)
@@ -163,7 +163,8 @@ void Texture_dealloc (Texture * self)
        // release renderer
        Py_XDECREF(self->m_source);
        // close texture
-       Texture_close(self);
+       PyObject* ret = Texture_close(self);
+       Py_DECREF(ret);
        // release scaled image buffer
        delete [] self->m_scaledImg;
        // release object