summaryrefslogtreecommitdiff
path: root/libs/gui/ConsumerBase.cpp
diff options
context:
space:
mode:
author Igor Murashkin <iam@google.com> 2012-10-29 13:36:11 -0700
committer Igor Murashkin <iam@google.com> 2012-11-05 13:39:02 -0800
commita4a3149a36bc69a06e4824aeae909ab910661070 (patch)
tree9c6cd56ec3362090892d69b0fc4e0d1b31c2f98f /libs/gui/ConsumerBase.cpp
parent3bc7b2757125b511377ed918f83f5918d382c514 (diff)
Change ConsumerBase's FrameAvailableListener to be a weak pointer
This prevents strong reference cycles when the listener implementation also holds a strong pointer to the ConsumerBase Bug: 7425644 Change-Id: I1514b13a32b18d421c902dddebec0765a989c55c
Diffstat (limited to 'libs/gui/ConsumerBase.cpp')
-rw-r--r--libs/gui/ConsumerBase.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/libs/gui/ConsumerBase.cpp b/libs/gui/ConsumerBase.cpp
index 624d7e0156..2e7c42414c 100644
--- a/libs/gui/ConsumerBase.cpp
+++ b/libs/gui/ConsumerBase.cpp
@@ -99,7 +99,7 @@ void ConsumerBase::onFrameAvailable() {
sp<FrameAvailableListener> listener;
{ // scope for the lock
Mutex::Autolock lock(mMutex);
- listener = mFrameAvailableListener;
+ listener = mFrameAvailableListener.promote();
}
if (listener != NULL) {
@@ -148,7 +148,7 @@ void ConsumerBase::abandonLocked() {
}
void ConsumerBase::setFrameAvailableListener(
- const sp<FrameAvailableListener>& listener) {
+ const wp<FrameAvailableListener>& listener) {
CB_LOGV("setFrameAvailableListener");
Mutex::Autolock lock(mMutex);
mFrameAvailableListener = listener;