summaryrefslogtreecommitdiffstats
path: root/libs/gui
diff options
context:
space:
mode:
authorJamie Gennis <jgennis@google.com>2013-10-02 11:16:59 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-10-02 11:16:59 -0700
commit6be1d210eef392f5745d58a0033572b1af4b2f2a (patch)
tree26fca6657412b729d67a266872bec558ff8f572f /libs/gui
parent886b152111cc13dcfe1b47724f5e496f12ccc420 (diff)
parentf0cf5f103cf9c54d59de4ed6f1d8ddd2302dec1b (diff)
downloadframeworks_native-6be1d210eef392f5745d58a0033572b1af4b2f2a.zip
frameworks_native-6be1d210eef392f5745d58a0033572b1af4b2f2a.tar.gz
frameworks_native-6be1d210eef392f5745d58a0033572b1af4b2f2a.tar.bz2
am f0cf5f10: BufferQueue: fix a test crash
* commit 'f0cf5f103cf9c54d59de4ed6f1d8ddd2302dec1b': BufferQueue: fix a test crash
Diffstat (limited to 'libs/gui')
-rw-r--r--libs/gui/BufferQueue.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/libs/gui/BufferQueue.cpp b/libs/gui/BufferQueue.cpp
index 87d66e2..c165a68 100644
--- a/libs/gui/BufferQueue.cpp
+++ b/libs/gui/BufferQueue.cpp
@@ -668,11 +668,15 @@ status_t BufferQueue::connect(const sp<IBinder>& token,
mConnectedApi = api;
output->inflate(mDefaultWidth, mDefaultHeight, mTransformHint, mQueue.size());
- // set-up a death notification so that we can disconnect automatically
- // when/if the remote producer dies.
- // This will fail with INVALID_OPERATION if the "token" is local to our process.
- if (token->linkToDeath(static_cast<IBinder::DeathRecipient*>(this)) == NO_ERROR) {
- mConnectedProducerToken = token;
+ // set-up a death notification so that we can disconnect
+ // automatically when/if the remote producer dies.
+ if (token != NULL && token->remoteBinder() != NULL) {
+ status_t err = token->linkToDeath(static_cast<IBinder::DeathRecipient*>(this));
+ if (err == NO_ERROR) {
+ mConnectedProducerToken = token;
+ } else {
+ ALOGE("linkToDeath failed: %s (%d)", strerror(-err), err);
+ }
}
}
break;