BPython:
- Manuel from MakeHuman reported a memory leak in NMesh_getVertsFromGroup, should be fixed now. A pylist was not being decref'ed.
This commit is contained in:
@@ -2439,7 +2439,7 @@ static PyObject *NMesh_getVertsFromGroup (PyObject *self, PyObject *args)
|
||||
float weight;
|
||||
int i, k, l1, l2, count;
|
||||
int num = 0;
|
||||
PyObject* tempVertexList;
|
||||
PyObject* tempVertexList = NULL;
|
||||
PyObject* vertexList;
|
||||
PyObject* listObject;
|
||||
int tempInt;
|
||||
@@ -2483,8 +2483,13 @@ static PyObject *NMesh_getVertsFromGroup (PyObject *self, PyObject *args)
|
||||
if(nIndex == -1)
|
||||
return EXPP_ReturnPyObjError (PyExc_AttributeError,
|
||||
"no deform groups assigned to mesh");
|
||||
|
||||
//temporary list
|
||||
tempVertexList = PyList_New(((Mesh*)object->data)->totvert);
|
||||
if (tempVertexList == NULL)
|
||||
return EXPP_ReturnPyObjError (PyExc_RuntimeError,
|
||||
"getVertsFromGroup: can't create pylist!");
|
||||
|
||||
count = 0;
|
||||
|
||||
if (listObject == (void *)-2054456) //do entire group
|
||||
@@ -2559,6 +2564,8 @@ static PyObject *NMesh_getVertsFromGroup (PyObject *self, PyObject *args)
|
||||
//only return what we need
|
||||
vertexList = PyList_GetSlice(tempVertexList, 0, count);
|
||||
|
||||
Py_DECREF(tempVertexList);
|
||||
|
||||
return (vertexList);
|
||||
}
|
||||
|
||||
|
||||
@@ -261,7 +261,7 @@ typedef struct {
|
||||
float no[3];
|
||||
float uvco[3];
|
||||
int index;
|
||||
char flag; /* see MVert flag in DNA_mesh_types */
|
||||
char flag; /* see MVert flag in DNA_meshdata_types */
|
||||
|
||||
} BPy_NMVert; /* an NMesh vertex */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user