diff options
author | Renato Araujo Oliveira Filho <renato.filho@openbossa.org> | 2011-01-12 19:30:23 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:12:53 -0300 |
commit | 0eef7934bc0dc0a3b915c1502bfc0be60d7eb365 (patch) | |
tree | 4c935849806a1424f434a18e0e6290d05e300f1a /libshiboken | |
parent | a260a414d8c875fbeda2862ce8adf7ddc1a9be3c (diff) |
Optimized setParent function.
Replaced use of find in the children list for check on the current
child if his has a parent and if the parent is the same.
Fixes bug #556
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Hugo Parente <hugo.lima@openbossa.org>
Diffstat (limited to 'libshiboken')
-rw-r--r-- | libshiboken/basewrapper.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libshiboken/basewrapper.cpp b/libshiboken/basewrapper.cpp index a44a6bf95..737bfadc9 100644 --- a/libshiboken/basewrapper.cpp +++ b/libshiboken/basewrapper.cpp @@ -911,9 +911,9 @@ void setParent(PyObject* parent, PyObject* child) if (!parentIsNull) { if (!parent_->d->parentInfo) parent_->d->parentInfo = new ParentInfo; + // do not re-add a child - ChildrenList& children = parent_->d->parentInfo->children; - if (std::find(children.begin(), children.end(), child_) != children.end()) + if (child_->d->parentInfo && (child_->d->parentInfo->parent == parent_)) return; } |