diff options
| author | Julian Andres Klode <jak@debian.org> | 2009-07-22 18:16:28 +0200 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2009-07-22 18:16:28 +0200 |
| commit | 544f14e0f2fb70b5a1f30786a93023a42d88290d (patch) | |
| tree | 22a6cb60e5bc61e2c45f7cae37acd96a9419b4c3 /python/acquire-item.cc | |
| parent | 6ba42d2e31f161fc0ebe5405cf63b616c3e822b4 (diff) | |
| download | python-apt-544f14e0f2fb70b5a1f30786a93023a42d88290d.tar.gz | |
python: 2nd part of the acquire fixes (one PyObject per C++ object).
Diffstat (limited to 'python/acquire-item.cc')
| -rw-r--r-- | python/acquire-item.cc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/python/acquire-item.cc b/python/acquire-item.cc index cf0a628e..1fb66080 100644 --- a/python/acquire-item.cc +++ b/python/acquire-item.cc @@ -176,13 +176,11 @@ static PyObject *acquireitem_repr(PyObject *Self) 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) { - pkgAcquire::Item *item = PyAcquireItem_ToCpp(self); - PyAcquireObject *Owner = (PyAcquireObject *)GetOwner<pkgAcquire::Item*>(self); - - PyAcquireItems item_struct = Owner->items[item]; - if (item_struct.file != 0 && item_struct.file != self) item_struct.file->Object = 0; if (item_struct.item != 0 && item_struct.item != self) { @@ -195,6 +193,12 @@ static void acquireitem_dealloc(PyObject *self) } 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); } |
