summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2011-03-22 10:40:15 -0300
committerRenato Filho <renato.filho@openbossa.org>2011-03-22 11:15:37 -0300
commit7a21a4f1373c069ec3161fe759269f467a592dab (patch)
tree1e5a554a65d4ab27edaeb5157a0d3a927b406958
parentcaec0092e785137612f441f3ea3e7142da95ae8e (diff)
downloadshiboken-7a21a4f1373c069ec3161fe759269f467a592dab.tar.gz
shiboken-7a21a4f1373c069ec3161fe759269f467a592dab.tar.xz
shiboken-7a21a4f1373c069ec3161fe759269f467a592dab.zip
Fixed parentInfo cleanup.
Fixes bug #735. Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Luciano Wolf <luciano.wolf@openbossa.org>
-rw-r--r--libshiboken/basewrapper.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/libshiboken/basewrapper.cpp b/libshiboken/basewrapper.cpp
index 185b05fa..d788a2d1 100644
--- a/libshiboken/basewrapper.cpp
+++ b/libshiboken/basewrapper.cpp
@@ -634,8 +634,6 @@ static void _destroyParentInfo(SbkObject* obj, bool keepReference)
removeParent(first, false, keepReference);
}
removeParent(obj, false);
- delete pInfo;
- obj->d->parentInfo = 0;
}
}
@@ -926,6 +924,12 @@ void removeParent(SbkObject* child, bool giveOwnershipBack, bool keepReference)
// Transfer ownership back to Python
child->d->hasOwnership = giveOwnershipBack;
+ if (pInfo->children.empty()) {
+ // Erase parentInfo data
+ delete pInfo;
+ child->d->parentInfo = 0;
+ }
+
// Remove parent ref
Py_CLEAR(child);
}
@@ -1032,7 +1036,6 @@ void* getTypeUserData(SbkObject* wrapper)
void keepReference(SbkObject* self, const char* key, PyObject* referredObject, bool append)
{
-
bool isNone = (!referredObject || (referredObject == Py_None));
if (!self->d->referredObjects)