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/sceneTimeLine.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/sceneTimeLine.c')
-rw-r--r-- | source/blender/python/api2_2x/sceneTimeLine.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/source/blender/python/api2_2x/sceneTimeLine.c b/source/blender/python/api2_2x/sceneTimeLine.c index 0a68c63752c..ab74115574e 100644 --- a/source/blender/python/api2_2x/sceneTimeLine.c +++ b/source/blender/python/api2_2x/sceneTimeLine.c @@ -170,7 +170,7 @@ static PyObject *TimeLine_getFramesMarked (BPy_TimeLine *self, PyObject *args) { PyObject *marker_dict= NULL; TimeMarker *marker_it= NULL; - PyObject *tmarker= NULL, *pyo= NULL; + PyObject *tmarker= NULL, *pyo= NULL, *tmpstr; if (!PyArg_ParseTuple (args, "|O", &tmarker)) return EXPP_ReturnPyObjError (PyExc_AttributeError, @@ -196,13 +196,16 @@ static PyObject *TimeLine_getFramesMarked (BPy_TimeLine *self, PyObject *args) { for (marker_it= self->marker_list->first; marker_it; marker_it= marker_it->next){ if (marker_it->frame==frm) { pyo= PyDict_GetItem ((PyObject*)marker_dict, PyInt_FromLong ((long int)marker_it->frame)); + tmpstr = PyString_FromString(marker_it->name); if (pyo) { - PyList_Append (pyo, PyString_FromString (marker_it->name)); - Py_INCREF (pyo); + PyList_Append (pyo, tmpstr); + Py_INCREF(pyo); }else{ - pyo = PyList_New (0); - PyList_Append (pyo, PyString_FromString (marker_it->name)); + pyo = PyList_New(0); + PyList_Append (pyo, tmpstr); } + Py_DECREF(tmpstr); + PyDict_SetItem (marker_dict, PyInt_FromLong ((long int)marker_it->frame), pyo); if (pyo) { Py_DECREF (pyo); @@ -216,13 +219,16 @@ static PyObject *TimeLine_getFramesMarked (BPy_TimeLine *self, PyObject *args) { marker_dict= PyDict_New (); for (marker_it= self->marker_list->first; marker_it; marker_it= marker_it->next) { pyo=PyDict_GetItem ((PyObject*)marker_dict, PyInt_FromLong ((long int)marker_it->frame)); + tmpstr = PyString_FromString(marker_it->name); if (pyo) { - PyList_Append (pyo, PyString_FromString (marker_it->name)); + PyList_Append (pyo, tmpstr); Py_INCREF (pyo); }else{ pyo= PyList_New (0); - PyList_Append (pyo, PyString_FromString (marker_it->name)); + PyList_Append (pyo, tmpstr); } + Py_DECREF(tmpstr); + PyDict_SetItem (marker_dict, PyInt_FromLong ((long int)marker_it->frame), pyo); if (pyo) { Py_DECREF (pyo); |