summaryrefslogtreecommitdiff
path: root/libs/utils/RefBase.cpp
diff options
context:
space:
mode:
author Mathias Agopian <mathias@google.com> 2011-05-20 13:15:20 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2011-05-20 13:15:20 -0700
commitd31099f021e998cd4720f18380b9feac863eba07 (patch)
treedc6b00566431771934a0e1084a316317338b994e /libs/utils/RefBase.cpp
parent3933bcd76f1d3fd70adfaa8295e207c4d04a8c0d (diff)
parent8561698c9bd2fd91aee81a3ac8fa5a2f7d2351f6 (diff)
Merge "Call RefBase::destroy() when OBJECT_LIFETIME_* is not the default"
Diffstat (limited to 'libs/utils/RefBase.cpp')
-rw-r--r--libs/utils/RefBase.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/libs/utils/RefBase.cpp b/libs/utils/RefBase.cpp
index 9f55a71579..dd0052ab99 100644
--- a/libs/utils/RefBase.cpp
+++ b/libs/utils/RefBase.cpp
@@ -419,7 +419,8 @@ void RefBase::weakref_type::decWeak(const void* id)
if ((impl->mFlags&OBJECT_LIFETIME_WEAK) != OBJECT_LIFETIME_WEAK) {
if (impl->mStrong == INITIAL_STRONG_VALUE)
- delete impl->mBase;
+ if (impl->mBase)
+ impl->mBase->destroy();
else {
// LOGV("Freeing refs %p of old RefBase %p\n", this, impl->mBase);
delete impl;
@@ -427,7 +428,8 @@ void RefBase::weakref_type::decWeak(const void* id)
} else {
impl->mBase->onLastWeakRef(id);
if ((impl->mFlags&OBJECT_LIFETIME_FOREVER) != OBJECT_LIFETIME_FOREVER) {
- delete impl->mBase;
+ if (impl->mBase)
+ impl->mBase->destroy();
}
}
}