summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2011-05-19 19:41:37 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-05-19 19:41:37 -0700
commit16fa5aae96ec7bb0ecf1578197b64d477bb6946e (patch)
treefb7f8f56eb4984f404c30efa434c34495e9da66a /libs
parente219b5452c20b069b25109a8bedca8d37ec3ccb6 (diff)
parent6db8c505398a0979853f6c166e0a8bcafd9268f8 (diff)
downloadframeworks_base-16fa5aae96ec7bb0ecf1578197b64d477bb6946e.zip
frameworks_base-16fa5aae96ec7bb0ecf1578197b64d477bb6946e.tar.gz
frameworks_base-16fa5aae96ec7bb0ecf1578197b64d477bb6946e.tar.bz2
Merge "RefBase subclasses can now decide how they want to be destroyed."
Diffstat (limited to 'libs')
-rw-r--r--libs/utils/RefBase.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/libs/utils/RefBase.cpp b/libs/utils/RefBase.cpp
index 2034486..9f55a71 100644
--- a/libs/utils/RefBase.cpp
+++ b/libs/utils/RefBase.cpp
@@ -345,6 +345,10 @@ void RefBase::incStrong(const void* id) const
const_cast<RefBase*>(this)->onFirstRef();
}
+void RefBase::destroy() const {
+ delete this;
+}
+
void RefBase::decStrong(const void* id) const
{
weakref_impl* const refs = mRefs;
@@ -357,7 +361,7 @@ void RefBase::decStrong(const void* id) const
if (c == 1) {
const_cast<RefBase*>(this)->onLastStrongRef(id);
if ((refs->mFlags&OBJECT_LIFETIME_WEAK) != OBJECT_LIFETIME_WEAK) {
- delete this;
+ destroy();
}
}
refs->decWeak(id);