summaryrefslogtreecommitdiff
path: root/python/cache.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2013-10-21 11:23:35 +0200
committerJulian Andres Klode <jak@debian.org>2013-10-21 11:23:35 +0200
commit71796ca442960efe89fe3519e8bc6dbfe96b56dc (patch)
tree3e9cba78de6291b2253f18d80cd718079d31d865 /python/cache.cc
parentc7fd83fdfca918a7cf0b416d341bf7687a11792f (diff)
downloadpython-apt-71796ca442960efe89fe3519e8bc6dbfe96b56dc.tar.gz
python/cache.cc: Set NoDelete=true when creating Policy, fixes segfault in destructor
Diffstat (limited to 'python/cache.cc')
-rw-r--r--python/cache.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/python/cache.cc b/python/cache.cc
index 65b99210..40782838 100644
--- a/python/cache.cc
+++ b/python/cache.cc
@@ -180,8 +180,12 @@ static PyObject *PkgCacheGetGroups(PyObject *Self, void*) {
static PyObject *PkgCacheGetPolicy(PyObject *Self, void*) {
pkgCacheFile *CacheFile = GetCpp<pkgCacheFile *>(Self);
- std::cerr << "policy: " << CacheFile->Policy << std::endl;
- return CppPyObject_NEW<pkgPolicy*>(Self,&PyPolicy_Type,CacheFile->Policy);
+ CppPyObject<pkgPolicy*> *obj;
+
+ obj = CppPyObject_NEW<pkgPolicy*>(Self,&PyPolicy_Type,CacheFile->Policy);
+ obj->NoDelete = true;
+
+ return obj;
}
static PyObject *PkgCacheGetPackages(PyObject *Self, void*) {