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

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

gralloc1: Acquire mutex early in release am: 56ec3afb am: 37aa42d2

am: 3dc52417

Change-Id: If6ce570aef96611e1c820081c3e56e91aab3e159
parents 02400591 3dc52417
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -294,6 +294,7 @@ gralloc1_error_t Gralloc1On0Adapter::allocateWithIdHook(
gralloc1_error_t Gralloc1On0Adapter::retain(
gralloc1_error_t Gralloc1On0Adapter::retain(
        const std::shared_ptr<Buffer>& buffer)
        const std::shared_ptr<Buffer>& buffer)
{
{
    std::lock_guard<std::mutex> lock(mBufferMutex);
    buffer->retain();
    buffer->retain();
    return GRALLOC1_ERROR_NONE;
    return GRALLOC1_ERROR_NONE;
}
}
@@ -301,6 +302,7 @@ gralloc1_error_t Gralloc1On0Adapter::retain(
gralloc1_error_t Gralloc1On0Adapter::release(
gralloc1_error_t Gralloc1On0Adapter::release(
        const std::shared_ptr<Buffer>& buffer)
        const std::shared_ptr<Buffer>& buffer)
{
{
    std::lock_guard<std::mutex> lock(mBufferMutex);
    if (!buffer->release()) {
    if (!buffer->release()) {
        return GRALLOC1_ERROR_NONE;
        return GRALLOC1_ERROR_NONE;
    }
    }
@@ -320,7 +322,6 @@ gralloc1_error_t Gralloc1On0Adapter::release(
        }
        }
    }
    }


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