diff options
author | Renato Filho <renato.filho@openbossa.org> | 2010-02-03 16:18:46 -0300 |
---|---|---|
committer | Hugo Lima <hugo.lima@openbossa.org> | 2010-02-03 16:43:38 -0200 |
commit | 95d80742bc2916c88c0b7eac7a7b40c064ba1afe (patch) | |
tree | 581161b205108c72cf426db4e7afe9aa5b9aca61 /libshiboken | |
parent | 17ff35fce3df1b4e52758aaf017cc0261f48deca (diff) |
Fixed possible error in reparent process;
Reviewed by Hugo Parente <hugo.lima@openbossa.org>
Diffstat (limited to 'libshiboken')
-rw-r--r-- | libshiboken/basewrapper.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libshiboken/basewrapper.cpp b/libshiboken/basewrapper.cpp index 5bd37c52c..512722b84 100644 --- a/libshiboken/basewrapper.cpp +++ b/libshiboken/basewrapper.cpp @@ -75,6 +75,9 @@ void setParent(PyObject* parent, PyObject* child) bool hasAnotherParent = child_->parentInfo->parent && child_->parentInfo->parent != parent_; + //Avoid destroy child during reparent operation + Py_INCREF(child); + // check if we need to remove this child from the old parent if (parentIsNull || hasAnotherParent) removeParent(child_); @@ -85,6 +88,8 @@ void setParent(PyObject* parent, PyObject* child) parent_->parentInfo->children.push_back(child_); Py_INCREF(child_); } + + Py_DECREF(child); } static void _destroyParentInfo(SbkBaseWrapper* obj, bool removeFromParent) |