aboutsummaryrefslogtreecommitdiffstats
path: root/libshiboken
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2010-02-03 16:18:46 -0300
committerHugo Lima <hugo.lima@openbossa.org>2010-02-03 16:43:38 -0200
commit95d80742bc2916c88c0b7eac7a7b40c064ba1afe (patch)
tree581161b205108c72cf426db4e7afe9aa5b9aca61 /libshiboken
parent17ff35fce3df1b4e52758aaf017cc0261f48deca (diff)
Fixed possible error in reparent process;
Reviewed by Hugo Parente <hugo.lima@openbossa.org>
Diffstat (limited to 'libshiboken')
-rw-r--r--libshiboken/basewrapper.cpp5
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)