diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-04-15 08:34:27 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-04-15 08:34:27 +0400 |
commit | efb7dd86ff001efe26fba1caef70a87806d138f6 (patch) | |
tree | bbb3f8a9e12b729040e723c6ead623a19cceb28b /source/gameengine | |
parent | 4fe917ba2607f79cd60bbe373ef06d8e8c8aeacd (diff) |
Fix for own recent reference count error.
- The armature weakref list was being incref'd twice then decrefed twice (incref and decref were used incorrectly), now only once. My 'fix' broke this.
- In bpy_pydriver_create_dict the 2 refs added from running PyDict_SetItemString twice were undone when clearing the dictionary (added comment)
- changed Py_XDECREF to Py_DECREF int BPY_pyconstraint_update and BPY_pyconstraint_target, Py_XDECREF checs for NULL value which would have crashed blender before it got to Py_XDECREF anyway.
- after every error is reported (PyErr_Print), remove sys.last_traceback and clear the error, I found this fixed certain crashes (usually when starting the game engine or exiting blender), so best do this all the time.
- header_text.c, CcdPhysicsEnvironment.cpp, KX_CameraActuator.cpp - remove some warnings.
Diffstat (limited to 'source/gameengine')
4 files changed, 6 insertions, 4 deletions
diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp index 0e6b9d1e8f1..1c5b597f937 100644 --- a/source/gameengine/GameLogic/SCA_PythonController.cpp +++ b/source/gameengine/GameLogic/SCA_PythonController.cpp @@ -300,7 +300,7 @@ bool SCA_PythonController::Compile() * their user count. Not to mention holding references to wrapped data. * This is especially bad when the PyObject for the wrapped data is free'd, after blender * has alredy dealocated the pointer */ - PySys_SetObject( (char *)"last_traceback", Py_None); + PySys_SetObject( (char *)"last_traceback", NULL); PyErr_Clear(); /* just to be sure */ return false; @@ -358,7 +358,7 @@ void SCA_PythonController::Trigger(SCA_LogicManager* logicmgr) * their user count. Not to mention holding references to wrapped data. * This is especially bad when the PyObject for the wrapped data is free'd, after blender * has alredy dealocated the pointer */ - PySys_SetObject( (char *)"last_traceback", Py_None); + PySys_SetObject( (char *)"last_traceback", NULL); PyErr_Clear(); /* just to be sure */ //PyRun_SimpleString(m_scriptText.Ptr()); diff --git a/source/gameengine/Ketsji/KX_CameraActuator.cpp b/source/gameengine/Ketsji/KX_CameraActuator.cpp index 0118e490773..329d31cfa25 100644 --- a/source/gameengine/Ketsji/KX_CameraActuator.cpp +++ b/source/gameengine/Ketsji/KX_CameraActuator.cpp @@ -611,7 +611,7 @@ int KX_CameraActuator::pyattr_set_object(void *self_v, const KX_PYATTRIBUTE_DEF if (self->m_ob) self->m_ob->UnregisterActuator(self); - if (self->m_ob = (SCA_IObject*)gameobj) + if ((self->m_ob = (SCA_IObject*)gameobj)) self->m_ob->RegisterActuator(self); return 0; diff --git a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp index 56a1daa7544..056442f77d9 100644 --- a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp +++ b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp @@ -109,6 +109,8 @@ bool KX_PolygonMaterial::Activate(RAS_IRasterizer* rasty, TCachingInfo& cachingI else { PyErr_Print(); + PyErr_Clear(); + PySys_SetObject( (char *)"last_traceback", NULL); } } else diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp index 858416bae6a..3e1e0294321 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp @@ -1346,7 +1346,7 @@ struct OcclusionBuffer static int clip(const btVector4* pi,btVector4* po) { btScalar s[2*NP]; - btVector4 pn[2*NP], *p; + btVector4 pn[2*NP]; int i, j, m, n, ni; // deal with near clipping for(i=0, m=0;i<NP;++i) |