diff options
author | renatofilho <renato.filho@openbossa.org> | 2010-10-22 14:44:11 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:07:23 -0300 |
commit | 4f70e2056b76a51b839dbddb499c0c4de2ba1f29 (patch) | |
tree | 495029e08b4138e489bf7eb14e5981bee6334d9d /libshiboken | |
parent | 03f1e7b4982fe8d8335b7b04f66825e49ff66531 (diff) |
Fixed Wrapper object parent invalidation process.
Fixes bug #432.
Reviewer: Hugo Parente Lima <hugo.pl@gmail.com>
Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'libshiboken')
-rw-r--r-- | libshiboken/basewrapper.cpp | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/libshiboken/basewrapper.cpp b/libshiboken/basewrapper.cpp index 2c1129b2d..4983f6784 100644 --- a/libshiboken/basewrapper.cpp +++ b/libshiboken/basewrapper.cpp @@ -242,24 +242,26 @@ static void _destroyParentInfo(SbkBaseWrapper* obj, bool removeFromParent) if (removeFromParent && pInfo && pInfo->parent) removeParent(obj); - ChildrenList::iterator it = pInfo->children.begin(); - for (; it != pInfo->children.end(); ++it) { - SbkBaseWrapper*& child = *it; - - // keep this, the wrapper still alive - if (!SbkBaseWrapper_containsCppWrapper(obj) && - SbkBaseWrapper_containsCppWrapper(child) && - child->parentInfo) { - child->parentInfo->parent = 0; - child->parentInfo->hasWrapperRef = true; - SbkBaseWrapper_setOwnership(child, false); - } else { - _destroyParentInfo(child, false); - Py_DECREF(child); + if (pInfo) { + ChildrenList::iterator it = pInfo->children.begin(); + for (; it != pInfo->children.end(); ++it) { + SbkBaseWrapper*& child = *it; + + // keep this, the wrapper still alive + if (!SbkBaseWrapper_containsCppWrapper(obj) && + SbkBaseWrapper_containsCppWrapper(child) && + child->parentInfo) { + child->parentInfo->parent = 0; + child->parentInfo->hasWrapperRef = true; + SbkBaseWrapper_setOwnership(child, false); + } else { + _destroyParentInfo(child, false); + Py_DECREF(child); + } } + delete pInfo; + obj->parentInfo = 0; } - delete pInfo; - obj->parentInfo = 0; } void destroyParentInfo(SbkBaseWrapper* obj, bool removeFromParent) |