diff options
Diffstat (limited to 'libs/rs/rsObjectBase.cpp')
-rw-r--r-- | libs/rs/rsObjectBase.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/libs/rs/rsObjectBase.cpp b/libs/rs/rsObjectBase.cpp index f428f94..f5ced26 100644 --- a/libs/rs/rsObjectBase.cpp +++ b/libs/rs/rsObjectBase.cpp @@ -81,6 +81,10 @@ void ObjectBase::incSysRef() const { void ObjectBase::preDestroy() const { } +bool ObjectBase::freeChildren() { + return false; +} + bool ObjectBase::checkDelete(const ObjectBase *ref) { if (!ref) { return false; @@ -217,6 +221,28 @@ void ObjectBase::zeroAllUserRef(Context *rsc) { } } +void ObjectBase::freeAllChildren(Context *rsc) { + if (rsc->props.mLogObjects) { + LOGV("Forcing release of all child objects."); + } + + // This operation can be slow, only to be called during context cleanup. + ObjectBase * o = (ObjectBase *)rsc->mObjHead; + while (o) { + if (o->freeChildren()) { + // deleted ref to self and possibly others, restart from head. + o = (ObjectBase *)rsc->mObjHead; + } else { + o = (ObjectBase *)o->mNext; + } + } + + if (rsc->props.mLogObjects) { + LOGV("Objects remaining."); + dumpAll(rsc); + } +} + void ObjectBase::dumpAll(Context *rsc) { asyncLock(); |