Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3b3a5bb1 authored by Ajit Kumar's avatar Ajit Kumar Committed by android-build-merger
Browse files

gralloc1: Acquire mutex early in release

am: 56ec3afb

Change-Id: I7aaea43b24c8aa482d557057f3d715b56bdf4cec
parents 0f48c45e 56ec3afb
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -288,6 +288,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;
}
@@ -295,6 +296,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;
    }
@@ -314,7 +316,6 @@ gralloc1_error_t Gralloc1On0Adapter::release(
        }
    }

    std::lock_guard<std::mutex> lock(mBufferMutex);
    mBuffers.erase(handle);
    return GRALLOC1_ERROR_NONE;
}