From 7da1c05e1edc39ecd7aa9c48e50048952b1759be Mon Sep 17 00:00:00 2001 From: Fan Xu Date: Wed, 16 Jan 2019 15:31:04 -0800 Subject: 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 --- services/bufferhub/BufferClient.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'services/bufferhub/BufferClient.cpp') 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 lock(mClosedMutex); + if (!mClosed) { + ALOGW("%s: client of buffer #%d destroyed without close. Closing it now.", __FUNCTION__, + mBufferNode->id()); + } + } + close(); } -- cgit v1.2.3-59-g8ed1b