diff options
author | Marco Nelissen <marcone@google.com> | 2011-06-06 09:55:15 -0700 |
---|---|---|
committer | Marco Nelissen <marcone@google.com> | 2011-06-06 09:55:15 -0700 |
commit | b2fd84ad1d470d607af4a83da378d4e317421634 (patch) | |
tree | 7f3004f80d6e46b33317676d8d11b79aa3c6bb69 /libs | |
parent | fc51aaec82ecedb554d158e4284761c9348d09fd (diff) | |
parent | b9783b49f4727a0365f2297bb903db8682855adf (diff) | |
download | frameworks_base-b2fd84ad1d470d607af4a83da378d4e317421634.zip frameworks_base-b2fd84ad1d470d607af4a83da378d4e317421634.tar.gz frameworks_base-b2fd84ad1d470d607af4a83da378d4e317421634.tar.bz2 |
resolved conflicts for merge of b9783b49 to honeycomb-plus-aosp
Change-Id: I1d86ea56b3d1d1b69f6671e5b0df0ca3f0c79643
Diffstat (limited to 'libs')
-rw-r--r-- | libs/utils/RefBase.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/libs/utils/RefBase.cpp b/libs/utils/RefBase.cpp index 2034486..dd0052a 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); @@ -415,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; @@ -423,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(); } } } |