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

Commit 55be505a authored by Shuzhen Wang's avatar Shuzhen Wang
Browse files

Surface: Use buffer id to synchronize slots

For the same buffer, GraphicBuffer's buffer_handle_t* may change when
doing attach/detach. Use Id instead.

Test: Call attach/detach, and observe mRemovedBuffers is updated
Bug: 38238747
Change-Id: I6ab1ae5340565f98cb981b7e38c31a4f85190e56
parent b667c05f
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -1231,7 +1231,7 @@ int Surface::detachNextBuffer(sp<GraphicBuffer>* outBuffer,


    for (int i = 0; i < NUM_BUFFER_SLOTS; i++) {
    for (int i = 0; i < NUM_BUFFER_SLOTS; i++) {
        if (mSlots[i].buffer != NULL &&
        if (mSlots[i].buffer != NULL &&
                mSlots[i].buffer->handle == buffer->handle) {
                mSlots[i].buffer->getId() == buffer->getId()) {
            if (mReportRemovedBuffers) {
            if (mReportRemovedBuffers) {
                mRemovedBuffers.push_back(mSlots[i].buffer);
                mRemovedBuffers.push_back(mSlots[i].buffer);
            }
            }