summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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*) {