Commit 4eb6bf32 authored by Julian Andres Klode's avatar Julian Andres Klode

python/ Fix deletion of MetaIndex objects returned in SourceList.list.

First of all, make the objects mortal by decreasing their refcount after
adding them to the list. Secondly, make the objects owned by SourceList
and thirdly, set NoDelete on them, because they are managed by SourceList.
parent ebdbc02b
......@@ -90,9 +90,12 @@ static PyObject *PkgSourceListGetList(PyObject *Self,void*)
for (vector<metaIndex *>::const_iterator I = list->begin();
I != list->end(); I++)
PyObject *Obj;
Obj = CppPyObject_NEW<metaIndex*>(&MetaIndexType,*I);
CppOwnedPyObject<metaIndex*> *Obj;
Obj = CppOwnedPyObject_NEW<metaIndex*>(Self, &MetaIndexType,*I);
// Never delete metaIndex*, they are managed by the pkgSourceList.
Obj->NoDelete = true;
return List;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment