diff options
author | Mathias Agopian <mathias@google.com> | 2011-06-15 20:42:47 -0700 |
---|---|---|
committer | Alex Ray <aray@google.com> | 2013-07-30 13:56:57 -0700 |
commit | 9c8fa9ed4111c69c82ace01c8a7ac3beeacdce78 (patch) | |
tree | f04e23041d0b4dd0c2585bd8f461061652d8d4d5 /libs | |
parent | 267ba69c2e4ae39b9fe98d4be592c7b59e7e57a1 (diff) | |
download | core-9c8fa9ed4111c69c82ace01c8a7ac3beeacdce78.tar.gz core-9c8fa9ed4111c69c82ace01c8a7ac3beeacdce78.tar.bz2 core-9c8fa9ed4111c69c82ace01c8a7ac3beeacdce78.zip |
revert surfaceflinger leak fix as it uncovered a crasher on xoom (DO NOT MERGE)
This reverts commit 52a43990880b27808bcf562afcc4209d34728e6e.
Change-Id: I1856a48f863b051395b8091ddfd1e01292fa1b1e
Diffstat (limited to 'libs')
-rw-r--r-- | libs/utils/RefBase.cpp | 44 |
1 files changed, 9 insertions, 35 deletions
diff --git a/libs/utils/RefBase.cpp b/libs/utils/RefBase.cpp index 47ef546df..32e900a7f 100644 --- a/libs/utils/RefBase.cpp +++ b/libs/utils/RefBase.cpp @@ -48,11 +48,6 @@ namespace android { // --------------------------------------------------------------------------- -RefBase::Destroyer::~Destroyer() { -} - -// --------------------------------------------------------------------------- - class RefBase::weakref_impl : public RefBase::weakref_type { public: @@ -60,7 +55,7 @@ public: volatile int32_t mWeak; RefBase* const mBase; volatile int32_t mFlags; - Destroyer* mDestroyer; + #if !DEBUG_REFS @@ -69,7 +64,6 @@ public: , mWeak(0) , mBase(base) , mFlags(0) - , mDestroyer(0) { } @@ -316,11 +310,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) { - if (refs->mDestroyer) { - refs->mDestroyer->destroy(this); - } else { - delete this; - } + delete this; } } refs->removeWeakRef(id); @@ -355,9 +345,7 @@ int32_t RefBase::getStrongCount() const return mRefs->mStrong; } -void RefBase::setDestroyer(RefBase::Destroyer* destroyer) { - mRefs->mDestroyer = destroyer; -} + RefBase* RefBase::weakref_type::refBase() const { @@ -381,28 +369,16 @@ void RefBase::weakref_type::decWeak(const void* id) if (c != 1) return; if ((impl->mFlags&OBJECT_LIFETIME_WEAK) != OBJECT_LIFETIME_WEAK) { - if (impl->mStrong == INITIAL_STRONG_VALUE) { - if (impl->mBase) { - if (impl->mDestroyer) { - impl->mDestroyer->destroy(impl->mBase); - } else { - delete impl->mBase; - } - } - } else { + if (impl->mStrong == INITIAL_STRONG_VALUE) + delete impl->mBase; + else { // LOGV("Freeing refs %p of old RefBase %p\n", this, impl->mBase); delete impl; } } else { impl->mBase->onLastWeakRef(id); if ((impl->mFlags&OBJECT_LIFETIME_FOREVER) != OBJECT_LIFETIME_FOREVER) { - if (impl->mBase) { - if (impl->mDestroyer) { - impl->mDestroyer->destroy(impl->mBase); - } else { - delete impl->mBase; - } - } + delete impl->mBase; } } } @@ -526,10 +502,8 @@ RefBase::RefBase() RefBase::~RefBase() { - if ((mRefs->mFlags & OBJECT_LIFETIME_WEAK) == OBJECT_LIFETIME_WEAK) { - if (mRefs->mWeak == 0) { - delete mRefs; - } + if (mRefs->mWeak == 0) { + delete mRefs; } } |