From 71796ca442960efe89fe3519e8bc6dbfe96b56dc Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 21 Oct 2013 11:23:35 +0200 Subject: python/cache.cc: Set NoDelete=true when creating Policy, fixes segfault in destructor --- debian/changelog | 2 ++ python/cache.cc | 8 ++++++-- 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(Self); - std::cerr << "policy: " << CacheFile->Policy << std::endl; - return CppPyObject_NEW(Self,&PyPolicy_Type,CacheFile->Policy); + CppPyObject *obj; + + obj = CppPyObject_NEW(Self,&PyPolicy_Type,CacheFile->Policy); + obj->NoDelete = true; + + return obj; } static PyObject *PkgCacheGetPackages(PyObject *Self, void*) { -- cgit v1.2.3