summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Fan Xu <fanxu@google.com> 2019-01-16 15:31:04 -0800
committer Fan Xu <fanxu@google.com> 2019-01-16 15:55:33 -0800
commit7da1c05e1edc39ecd7aa9c48e50048952b1759be (patch)
tree14161ae9562b85574043142e972acf8a36b1071d
parentae691837f50a38a15cff2d5e927c92f75d6503c1 (diff)
Log when BufferClient destroyed without close
The destructor will now check mClosed and log at warning level if the client is closed. This Could happen when the client process forget to call close or died. Test: run VtsHalBufferHubV1_0TargetTest, then check "adb logcat | grep ~BufferClient" Fix: 122916649 Change-Id: I717b4ac3896a0672a5a3b81c802093f9da58c903
-rw-r--r--services/bufferhub/BufferClient.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/services/bufferhub/BufferClient.cpp b/services/bufferhub/BufferClient.cpp
index e312011696..ec7e535699 100644
--- a/services/bufferhub/BufferClient.cpp
+++ b/services/bufferhub/BufferClient.cpp
@@ -41,6 +41,14 @@ BufferClient* BufferClient::create(BufferHubService* service,
}
BufferClient::~BufferClient() {
+ {
+ std::lock_guard<std::mutex> lock(mClosedMutex);
+ if (!mClosed) {
+ ALOGW("%s: client of buffer #%d destroyed without close. Closing it now.", __FUNCTION__,
+ mBufferNode->id());
+ }
+ }
+
close();
}