summaryrefslogtreecommitdiff
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
parentc7fd83fdfca918a7cf0b416d341bf7687a11792f (diff)
downloadpython-apt-71796ca442960efe89fe3519e8bc6dbfe96b56dc.tar.gz
python/cache.cc: Set NoDelete=true when creating Policy, fixes segfault in destructor
-rw-r--r--debian/changelog2
-rw-r--r--python/cache.cc8
2 files changed, 8 insertions, 2 deletions
diff --git a/debian/changelog b/debian/changelog
index 39298b86..a8be3040 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,6 +13,8 @@ python-apt (0.9.0) UNRELEASED; urgency=low
- Document correct use of uniq and hide it using __all__ (Closes: #723815)
* python/apt_pkgmodule.cc:
- Fix documentation of version_compare (Closes: #680891)
+ * python/cache.cc:
+ - Set NoDelete=true when creating Policy, fixes segfault in destructor
* apt/package.py:
- Add a Package.has_config_files property (Closes: #712749)
* tests:
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*) {