summaryrefslogtreecommitdiff
path: root/libs/ui/Gralloc1On0Adapter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ui/Gralloc1On0Adapter.cpp')
-rw-r--r--libs/ui/Gralloc1On0Adapter.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/libs/ui/Gralloc1On0Adapter.cpp b/libs/ui/Gralloc1On0Adapter.cpp
index 111879aed1..a0bbe63cbd 100644
--- a/libs/ui/Gralloc1On0Adapter.cpp
+++ b/libs/ui/Gralloc1On0Adapter.cpp
@@ -294,6 +294,7 @@ gralloc1_error_t Gralloc1On0Adapter::allocateWithIdHook(
gralloc1_error_t Gralloc1On0Adapter::retain(
const std::shared_ptr<Buffer>& buffer)
{
+ std::lock_guard<std::mutex> lock(mBufferMutex);
buffer->retain();
return GRALLOC1_ERROR_NONE;
}
@@ -301,6 +302,7 @@ gralloc1_error_t Gralloc1On0Adapter::retain(
gralloc1_error_t Gralloc1On0Adapter::release(
const std::shared_ptr<Buffer>& buffer)
{
+ std::lock_guard<std::mutex> lock(mBufferMutex);
if (!buffer->release()) {
return GRALLOC1_ERROR_NONE;
}
@@ -320,7 +322,6 @@ gralloc1_error_t Gralloc1On0Adapter::release(
}
}
- std::lock_guard<std::mutex> lock(mBufferMutex);
mBuffers.erase(handle);
return GRALLOC1_ERROR_NONE;
}