summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/TransactionCompletedThread.cpp
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2019-07-11 19:43:00 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2019-07-11 19:43:00 +0000
commit6990af63ff06297ffa0373daa32a196c29d99b95 (patch)
treed13bc64c30577944886681a92f2ec42e62cb8966 /services/surfaceflinger/TransactionCompletedThread.cpp
parente377b272429fef443b0f498568cbccf111950ba0 (diff)
parent0e24a8385a63be6a799da902e1d5ffcbb7519c2a (diff)
Merge "blast: fix leak on BufferStateLayer death" into qt-dev
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;
}