BGE Python API cleanup - no functionality changes
[blender.git] / source / gameengine / Ketsji / KX_BlenderMaterial.cpp
index 0e417dde5d223eb7b2d71ef64c58dc51e34553a3..6722cd232fe8c8a3392a8414585001ed25992bbb 100644 (file)
@@ -756,9 +756,9 @@ PyTypeObject KX_BlenderMaterial::Type = {
        PyObject_HEAD_INIT(NULL)
                0,
                "KX_BlenderMaterial",
-               sizeof(KX_BlenderMaterial),
+               sizeof(PyObjectPlus_Proxy),
                0,
-               PyDestructor,
+               py_base_dealloc,
                0,
                0,
                0,
@@ -827,8 +827,7 @@ KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getShader , "getShader()")
                        m_flag &= ~RAS_BLENDERGLSL;
                        mMaterial->SetSharedMaterial(true);
                        mScene->GetBucketManager()->ReleaseDisplayLists(this);
-                       Py_INCREF(mShader);
-                       return mShader;
+                       return mShader->GetProxy();
                }else
                {
                        // decref all references to the object
@@ -836,13 +835,8 @@ KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getShader , "getShader()")
                        // We will then go back to fixed functionality
                        // for this material
                        if(mShader) {
-                               if(mShader->ob_refcnt > 1) {
-                                       Py_DECREF(mShader);
-                               }
-                               else {
-                                       delete mShader;
-                                       mShader=0;
-                               }
+                               delete mShader; /* will handle python de-referencing */
+                               mShader=0;
                        }
                }
                Py_RETURN_NONE;