- use Py_CLEAR for python internally referencing other PyObjects (supposed to be...
[blender.git] / source / gameengine / Ketsji / KX_GameObject.cpp
index 5ca780bb319b79c3ec95280510abd7d90d62bce2..93d67e92dd5a0e1a1464552cdee5f81590628118 100644 (file)
@@ -157,7 +157,8 @@ KX_GameObject::~KX_GameObject()
 #ifdef WITH_PYTHON
        if (m_attr_dict) {
                PyDict_Clear(m_attr_dict); /* incase of circular refs or other weired cases */
-               Py_DECREF(m_attr_dict);
+               /* Py_CLEAR: Py_DECREF's and NULL's */
+               Py_CLEAR(m_attr_dict);
        }
 #endif // WITH_PYTHON
 }