diff options
Diffstat (limited to 'libs/gui/ConsumerBase.cpp')
-rw-r--r-- | libs/gui/ConsumerBase.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/libs/gui/ConsumerBase.cpp b/libs/gui/ConsumerBase.cpp index 8694d21..4937b17 100644 --- a/libs/gui/ConsumerBase.cpp +++ b/libs/gui/ConsumerBase.cpp @@ -76,7 +76,18 @@ ConsumerBase::ConsumerBase(const sp<BufferQueue>& bufferQueue) : } ConsumerBase::~ConsumerBase() { - CB_LOGV("~ConsumerBase"); + CB_LOGV("~ConsumerBase"); + Mutex::Autolock lock(mMutex); + + // Verify that abandon() has been called before we get here. This should + // be done by ConsumerBase::onLastStrongRef(), but it's possible for a + // derived class to override that method and not call + // ConsumerBase::onLastStrongRef(). + LOG_ALWAYS_FATAL_IF(!mAbandoned, "[%s] ~ConsumerBase was called, but the " + "consumer is not abandoned!", mName.string()); +} + +void ConsumerBase::onLastStrongRef(const void* id) { abandon(); } |