summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/TransactionCompletedThread.cpp
diff options
context:
space:
mode:
author Marissa Wall <marissaw@google.com> 2019-07-11 13:32:46 -0700
committer android-build-merger <android-build-merger@google.com> 2019-07-11 13:32:46 -0700
commit799a0d81b8142452c80fbbc305e2a7e7adf3537a (patch)
tree4da6eb381462b26c65e05bc32f9f4641b05a0437 /services/surfaceflinger/TransactionCompletedThread.cpp
parente0eed55e69d68abd9693485c635ad4942f414c00 (diff)
parent7879cacc5a7fc2b66c9de3ebbf0488ab60ef54b4 (diff)
Merge "blast: fix leak on BufferStateLayer death" into qt-dev am: 6990af63ff am: f5d22cff90
am: 7879cacc5a Change-Id: I79fe602bf5e27608b343e926e098a6e73326ad3a
Diffstat (limited to 'services/surfaceflinger/TransactionCompletedThread.cpp')
-rw-r--r--services/surfaceflinger/TransactionCompletedThread.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/services/surfaceflinger/TransactionCompletedThread.cpp b/services/surfaceflinger/TransactionCompletedThread.cpp
index 0806f2aa93..c519f8d647 100644
--- a/services/surfaceflinger/TransactionCompletedThread.cpp
+++ b/services/surfaceflinger/TransactionCompletedThread.cpp
@@ -228,8 +228,14 @@ status_t TransactionCompletedThread::addCallbackHandle(const sp<CallbackHandle>&
}
transactionStats->latchTime = handle->latchTime;
- transactionStats->surfaceStats.emplace_back(handle->surfaceControl, handle->acquireTime,
- handle->previousReleaseFence);
+ // If the layer has already been destroyed, don't add the SurfaceControl to the callback.
+ // The client side keeps a sp<> to the SurfaceControl so if the SurfaceControl has been
+ // destroyed the client side is dead and there won't be anyone to send the callback to.
+ sp<IBinder> surfaceControl = handle->surfaceControl.promote();
+ if (surfaceControl) {
+ transactionStats->surfaceStats.emplace_back(surfaceControl, handle->acquireTime,
+ handle->previousReleaseFence);
+ }
return NO_ERROR;
}