diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2019-07-12 04:10:44 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2019-07-12 04:10:44 +0000 |
commit | 3323a6e479006d04166094582288857578d41caf (patch) | |
tree | d13bc64c30577944886681a92f2ec42e62cb8966 | |
parent | ba0112f52fefc7a21cfeccf016285877031a4799 (diff) | |
parent | 369d1f5d13dc422a44b1eeeba31b118bec0effbf (diff) | |
download | native-3323a6e479006d04166094582288857578d41caf.tar.gz |
Merge cherrypicks of [8558068, 8558825, 8558826, 8558827, 8557109, 8558018, 8558886, 8558887, 8558888, 8558889, 8558071, 8558072, 8556231] into qt-release
Change-Id: If94b5583cacf7855e75758a6998568eefa39026b
-rw-r--r-- | services/surfaceflinger/TransactionCompletedThread.cpp | 10 | ||||
-rw-r--r-- | services/surfaceflinger/TransactionCompletedThread.h | 2 |
2 files changed, 9 insertions, 3 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; } diff --git a/services/surfaceflinger/TransactionCompletedThread.h b/services/surfaceflinger/TransactionCompletedThread.h index 21e2678701..e849f714d0 100644 --- a/services/surfaceflinger/TransactionCompletedThread.h +++ b/services/surfaceflinger/TransactionCompletedThread.h @@ -49,7 +49,7 @@ public: sp<ITransactionCompletedListener> listener; std::vector<CallbackId> callbackIds; - sp<IBinder> surfaceControl; + wp<IBinder> surfaceControl; bool releasePreviousBuffer = false; sp<Fence> previousReleaseFence; |