diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-05-25 20:43:25 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-05-25 20:43:25 +0400 |
commit | f231bd0d5715ac67767f96f3a8d20ebf618f7b03 (patch) | |
tree | 34c05572641b2eafad9fa8e342724e0b05b6b3d8 /source/blender/python/api2_2x/Effect.c | |
parent | a21f8292d9aeff54153fc65560d56b3d4f33575a (diff) |
Many long standing memory leaks fixed in the BPY api.
Data from Armature.c and logic.c still leaks.
Mostly todo with PyList_Append adding a refcount and the bpython api not decrefing.
Also added some features needed to fix a bug in mesh_clean.py (ob.pinShape and ob.activeShape)
Diffstat (limited to 'source/blender/python/api2_2x/Effect.c')
-rw-r--r-- | source/blender/python/api2_2x/Effect.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/source/blender/python/api2_2x/Effect.c b/source/blender/python/api2_2x/Effect.c index 560b67c1933..156c3bb26a6 100644 --- a/source/blender/python/api2_2x/Effect.c +++ b/source/blender/python/api2_2x/Effect.c @@ -1494,7 +1494,7 @@ static PyObject *Effect_getParticlesLoc( BPy_Effect * self ) Effect *eff; PartEff *paf; Particle *pa=0; - PyObject *list, *strand_list; + PyObject *list, *strand_list, *pyvec; float p_time, c_time, vec[3], vec1[3], cfra, m_time, s_time; int a; short disp=100 ; @@ -1545,12 +1545,17 @@ static PyObject *Effect_getParticlesLoc( BPy_Effect * self ) for(c_time= pa->time; c_time<m_time; c_time+=paf->staticstep) { where_is_particle(paf, pa, c_time, vec); MTC_Mat4MulVecfl(ob->obmat, vec); /* make worldspace like the others */ - if( PyList_Append( strand_list, newVectorObject(vec, 3, Py_NEW)) < 0 ) { + pyvec = newVectorObject(vec, 3, Py_NEW); + if( PyList_Append( strand_list, pyvec) < 0 ) { Py_DECREF( list ); Py_DECREF( strand_list ); + Py_XDECREF( pyvec ); + return EXPP_ReturnPyObjError( PyExc_RuntimeError, "Couldn't append item to PyList" ); } + Py_DECREF( pyvec ); + } if( PyList_Append( list, strand_list) < 0 ) { @@ -1589,12 +1594,14 @@ static PyObject *Effect_getParticlesLoc( BPy_Effect * self ) } } else { /* not a vector */ where_is_particle(paf, pa, c_time, vec); - if( PyList_Append( list, - newVectorObject(vec, 3, Py_NEW)) < 0 ) { + pyvec = newVectorObject(vec, 3, Py_NEW); + if( PyList_Append( list, pyvec) < 0 ) { Py_DECREF( list ); + Py_XDECREF( pyvec ); return EXPP_ReturnPyObjError( PyExc_RuntimeError, "Couldn't append item to PyList" ); } + Py_DECREF( pyvec ); } } } |