summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2011-05-19 20:41:27 -0700
committerMathias Agopian <mathias@google.com>2011-05-19 21:01:04 -0700
commitba3cf462738353bb4a2fc6eb890f91350d402cb5 (patch)
tree88cdb4f96d80e77b00b31565834a532c51df207c /libs
parent9e735541beed238d3b99d4bd284af1fc953c3775 (diff)
downloadframeworks_base-ba3cf462738353bb4a2fc6eb890f91350d402cb5.zip
frameworks_base-ba3cf462738353bb4a2fc6eb890f91350d402cb5.tar.gz
frameworks_base-ba3cf462738353bb4a2fc6eb890f91350d402cb5.tar.bz2
Call RefBase::destroy() when OBJECT_LIFETIME_* is not the default
Change-Id: Ifb2069e095dba57b7d97e9f2d942fd85fa975f58
Diffstat (limited to 'libs')
-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 9f55a71..dd0052a 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();
}
}
}