summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2010-01-23 19:24:04 +0100
committerJulian Andres Klode <jak@debian.org>2010-01-23 19:24:04 +0100
commit89752fb6d465c78026befcc5a61e8af655587ad7 (patch)
tree9bb70d5d9733acb77a860cf135b2e01babe8e859
parentc654ae4c10bf40922e2ecf8f1b7fe1c2b97a06aa (diff)
downloadpython-apt-89752fb6d465c78026befcc5a61e8af655587ad7.tar.gz
python/acquire-item.cc: Support items without an owner set.
-rw-r--r--debian/changelog2
-rw-r--r--python/acquire-item.cc38
2 files changed, 22 insertions, 18 deletions
diff --git a/debian/changelog b/debian/changelog
index 3fa0852f..87202817 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,8 @@ python-apt (0.7.93.1) UNRELEASED; urgency=low
- Fix Cache.update() to not raise errors on successful updates.
* python/progress.cc:
- Fix some threading issues (add some missing PyCbObj_BEGIN_ALLOW_THREADS)
+ * python/acquire-item.cc:
+ - Support items without an owner set.
-- Julian Andres Klode <jak@debian.org> Sat, 23 Jan 2010 15:35:55 +0100
diff --git a/python/acquire-item.cc b/python/acquire-item.cc
index 1fb66080..73aec1d6 100644
--- a/python/acquire-item.cc
+++ b/python/acquire-item.cc
@@ -178,26 +178,28 @@ static void acquireitem_dealloc(PyObject *self)
{
pkgAcquire::Item *item = PyAcquireItem_ToCpp(self);
PyAcquireObject *Owner = (PyAcquireObject *)GetOwner<pkgAcquire::Item*>(self);
- PyAcquireItems item_struct = Owner->items[item];
- // TODO: Unregister the object in the owner.
- if (!((CppOwnedPyObject<pkgAcquire::Item*>*)self)->NoDelete) {
- if (item_struct.file != 0 && item_struct.file != self)
- item_struct.file->Object = 0;
- if (item_struct.item != 0 && item_struct.item != self) {
- item_struct.item->Object = 0;
- Py_DECREF(item_struct.item);
+ if (Owner != NULL) {
+ PyAcquireItems item_struct = Owner->items[item];
+ // TODO: Unregister the object in the owner.
+ if (!((CppOwnedPyObject<pkgAcquire::Item*>*)self)->NoDelete) {
+ if (item_struct.file != 0 && item_struct.file != self)
+ item_struct.file->Object = 0;
+ if (item_struct.item != 0 && item_struct.item != self) {
+ item_struct.item->Object = 0;
+ Py_DECREF(item_struct.item);
+ }
+ if (item_struct.desc != 0) {
+ item_struct.desc->Object = 0;
+ Py_DECREF(item_struct.desc);
+ }
+ Owner->items.erase(item);
}
- if (item_struct.desc != 0) {
- item_struct.desc->Object = 0;
- Py_DECREF(item_struct.desc);
+ else {
+ if (item_struct.file == self)
+ item_struct.file = 0;
+ if (item_struct.item == self)
+ item_struct.item = 0;
}
- Owner->items.erase(item);
- }
- else {
- if (item_struct.file == self)
- item_struct.file = 0;
- if (item_struct.item == self)
- item_struct.item = 0;
}
CppOwnedDeallocPtr<pkgAcquire::Item*>(self);