summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/TransactionCompletedThread.cpp
diff options
context:
space:
mode:
author android-build-team Robot <android-build-team-robot@google.com> 2019-07-12 00:13:43 +0000
committer android-build-team Robot <android-build-team-robot@google.com> 2019-07-12 00:13:43 +0000
commit0c4a70fed471fda4330b1f250e0051451a27bc3d (patch)
treeefa047502af5e5fa08fa7cdfbde52dc557c2f4ba /services/surfaceflinger/TransactionCompletedThread.cpp
parent83dd5ec0fc97955eb53d171c303fdd5a5bfa3371 (diff)
parent9cacdacbb96ce8a67633873a7f0a844465ac5d76 (diff)
Merge cherrypicks of [8551866, 8551867, 8551868, 8552336, 8552337, 8552338, 8551869, 8552339, 8552376, 8551887] into qt-c2f2-release
Change-Id: Ic35a97b87844ba1c808faad1102ead0d402f01f1
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 5cf8eb1a1d..fd466dedff 100644
--- a/services/surfaceflinger/TransactionCompletedThread.cpp
+++ b/services/surfaceflinger/TransactionCompletedThread.cpp
@@ -197,8 +197,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;
}