From c45715cf0269bcef053025f01a1956b75bf3c859 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 12 Jul 2009 13:26:02 +0200 Subject: python/metaindex.cc: Fix deletion of the IndexFile objects in MetaIndex.index_files First of all, make the objects mortal by decreasing their refcount after adding them to the list. Secondly, make the objects owned by MetaIndex and thirdly, set NoDelete on them, because they are managed by metaIndex. --- python/metaindex.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'python/metaindex.cc') diff --git a/python/metaindex.cc b/python/metaindex.cc index 87b1e59a..195394d6 100644 --- a/python/metaindex.cc +++ b/python/metaindex.cc @@ -37,9 +37,12 @@ static PyObject *MetaIndexGetIndexFiles(PyObject *Self,void*) { for (vector::const_iterator I = indexFiles->begin(); I != indexFiles->end(); I++) { - PyObject *Obj; - Obj = CppPyObject_NEW(&PackageIndexFileType,*I); + CppOwnedPyObject *Obj; + Obj = CppOwnedPyObject_NEW(Self, &PackageIndexFileType,*I); + // Do not delete pkgIndexFile*, they are managed by metaIndex. + Obj->NoDelete = true; PyList_Append(List,Obj); + Py_DECREF(Obj); } return List; } -- cgit v1.2.3