fix for writing to freed memory in cases where python wasn't holding a reference...
authorCampbell Barton <ideasman42@gmail.com>
Tue, 4 Aug 2009 22:59:50 +0000 (22:59 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 4 Aug 2009 22:59:50 +0000 (22:59 +0000)
source/gameengine/Expressions/PyObjectPlus.cpp

index defb6853e67f2e21b19501aa9b29a3eb0649033d..921f608b772d697ceb00289a3f8ea7ecef73cf07 100644 (file)
@@ -85,8 +85,8 @@ PyTypeObject PyObjectPlus::Type = {
 PyObjectPlus::~PyObjectPlus()
 {
        if(m_proxy) {
-               Py_DECREF(m_proxy);                     /* Remove own reference, python may still have 1 */
                BGE_PROXY_REF(m_proxy)= NULL;
+               Py_DECREF(m_proxy);                     /* Remove own reference, python may still have 1 */
        }
 //     assert(ob_refcnt==0);
 }