diff options
author | Jamie Gennis <jgennis@google.com> | 2013-09-25 17:21:56 -0700 |
---|---|---|
committer | Jamie Gennis <jgennis@google.com> | 2013-10-02 18:02:28 +0000 |
commit | f0cf5f103cf9c54d59de4ed6f1d8ddd2302dec1b (patch) | |
tree | 113b7c75306095482824626dbb447a325b46bc5b | |
parent | a9c47f327373cbe48e187442c7f9554d24a75c08 (diff) | |
download | frameworks_native-f0cf5f103cf9c54d59de4ed6f1d8ddd2302dec1b.zip frameworks_native-f0cf5f103cf9c54d59de4ed6f1d8ddd2302dec1b.tar.gz frameworks_native-f0cf5f103cf9c54d59de4ed6f1d8ddd2302dec1b.tar.bz2 |
BufferQueue: fix a test crash
Bug: 10935880
Change-Id: If76e9fb055103bad0db7e6c16487532671573149
-rw-r--r-- | libs/gui/BufferQueue.cpp | 14 |
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; |