summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/Layer.cpp
diff options
context:
space:
mode:
author Dan Stoza <stoza@google.com> 2016-09-30 17:52:16 +0000
committer android-build-merger <android-build-merger@google.com> 2016-09-30 17:52:16 +0000
commit1ce7c1d3aae1c63e1925c20486a1168cdcd32e03 (patch)
tree3e9ddbff89f08cd3a6edc28514c9398686933808 /services/surfaceflinger/Layer.cpp
parent58719ff7665f1be2bf8c31624c766efdb5efb621 (diff)
parentde84eb6b823ff143f3465ce8f291f1100ce42168 (diff)
SF: Fix a couple of Layer ref count issues
am: de84eb6b82 Change-Id: I779b869d340ce5320f7924ccd6579cada3227899
Diffstat (limited to 'services/surfaceflinger/Layer.cpp')
-rw-r--r--services/surfaceflinger/Layer.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index a512acc1c9..9173165d0c 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -1289,9 +1289,14 @@ void Layer::pushPendingState() {
// If this transaction is waiting on the receipt of a frame, generate a sync
// point and send it to the remote layer.
if (mCurrentState.handle != nullptr) {
- sp<Handle> handle = static_cast<Handle*>(mCurrentState.handle.get());
- sp<Layer> handleLayer = handle->owner.promote();
- if (handleLayer == nullptr) {
+ sp<IBinder> strongBinder = mCurrentState.handle.promote();
+ sp<Handle> handle = nullptr;
+ sp<Layer> handleLayer = nullptr;
+ if (strongBinder != nullptr) {
+ handle = static_cast<Handle*>(strongBinder.get());
+ handleLayer = handle->owner.promote();
+ }
+ if (strongBinder == nullptr || handleLayer == nullptr) {
ALOGE("[%s] Unable to promote Layer handle", mName.string());
// If we can't promote the layer we are intended to wait on,
// then it is expired or otherwise invalid. Allow this transaction