- use Py_CLEAR for python internally referencing other PyObjects (supposed to be...
[blender.git] / source / gameengine / Ketsji / KX_Scene.cpp
index 0a8c3039ae3f6e07a9d75c688f5101c458079b73..4a379f46440ff951e1cb5d05bf65c064a9d3a596 100644 (file)
@@ -269,10 +269,12 @@ KX_Scene::~KX_Scene()
 
 #ifdef WITH_PYTHON
        PyDict_Clear(m_attr_dict);
-       Py_DECREF(m_attr_dict);
+       /* Py_CLEAR: Py_DECREF's and NULL's */
+       Py_CLEAR(m_attr_dict);
 
-       Py_XDECREF(m_draw_call_pre);
-       Py_XDECREF(m_draw_call_post);
+       /* these may be NULL but the macro checks */
+       Py_CLEAR(m_draw_call_pre);
+       Py_CLEAR(m_draw_call_post);
 #endif
 }