aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2011-09-20 18:21:12 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:17:14 -0300
commitdb9874a33cfb35d639b9ddf5347d7c60d5647b9a (patch)
tree5fe9cf6d7ca572c60bd51c33f2246e728af186f3
parent4e17f2620f10677e09b9cb93c7ba8efa703b158b (diff)
Fixed invalidate function in objects with refereces to other objects.
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Marcelo Lira <marcelo.lira@openbossa.org>
-rw-r--r--libshiboken/basewrapper.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/libshiboken/basewrapper.cpp b/libshiboken/basewrapper.cpp
index 5431c4149..7527e3bb1 100644
--- a/libshiboken/basewrapper.cpp
+++ b/libshiboken/basewrapper.cpp
@@ -869,6 +869,20 @@ void invalidate(SbkObject* self)
removeParent(*it, true, true);
}
}
+
+ // If has ref to other objects invalidate all
+ if (self->d->referredObjects) {
+ RefCountMap& refCountMap = *(self->d->referredObjects);
+ RefCountMap::iterator iter;
+ for (iter = refCountMap.begin(); iter != refCountMap.end(); ++iter) {
+ const std::list<PyObject*> lst = iter->second;
+ std::list<PyObject*>::const_iterator it = lst.begin();
+ while(it != lst.end()) {
+ invalidate(*it);
+ ++it;
+ }
+ }
+ }
}
void makeValid(SbkObject* self)
@@ -886,6 +900,21 @@ void makeValid(SbkObject* self)
for (; it != self->d->parentInfo->children.end(); ++it)
makeValid(*it);
}
+
+ // If has ref to other objects make all valid again
+ if (self->d->referredObjects) {
+ RefCountMap& refCountMap = *(self->d->referredObjects);
+ RefCountMap::iterator iter;
+ for (iter = refCountMap.begin(); iter != refCountMap.end(); ++iter) {
+ const std::list<PyObject*> lst = iter->second;
+ std::list<PyObject*>::const_iterator it = lst.begin();
+ while(it != lst.end()) {
+ if (Shiboken::Object::checkType(*it))
+ makeValid(reinterpret_cast<SbkObject*>(*it));
+ ++it;
+ }
+ }
+ }
}
bool hasParentInfo(SbkObject* pyObj)