Path: [skip ci] fix memory leak in TooltablePy::getTools()
For some background information see: https://forum.freecadweb.org/viewtopic.php?f=15&t=50583&start=20#p457516
This commit is contained in:
@@ -103,12 +103,12 @@ int TooltablePy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
|
||||
Py::Dict TooltablePy::getTools(void) const
|
||||
{
|
||||
PyObject *dict = PyDict_New();
|
||||
Py::Dict dict;
|
||||
for(std::map<int,Path::Tool*>::iterator i = getTooltablePtr()->Tools.begin(); i != getTooltablePtr()->Tools.end(); ++i) {
|
||||
PyObject *tool = new Path::ToolPy(i->second);
|
||||
PyDict_SetItem(dict,PYINT_FROMLONG(i->first),tool);
|
||||
dict.setItem(Py::Long(i->first), Py::asObject(tool));
|
||||
}
|
||||
return Py::Dict(dict);
|
||||
return dict;
|
||||
}
|
||||
|
||||
void TooltablePy::setTools(Py::Dict arg)
|
||||
|
||||
Reference in New Issue
Block a user