OSDN Git Service

Surface: Use buffer id to synchronize slots
authorShuzhen Wang <shuzhenwang@google.com>
Tue, 23 May 2017 16:41:54 +0000 (09:41 -0700)
committerShuzhen Wang <shuzhenwang@google.com>
Tue, 23 May 2017 16:46:24 +0000 (09:46 -0700)
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

libs/gui/Surface.cpp

index ff0a5d4..6583a62 100644 (file)
@@ -1231,7 +1231,7 @@ int Surface::detachNextBuffer(sp<GraphicBuffer>* outBuffer,
 
     for (int i = 0; i < NUM_BUFFER_SLOTS; i++) {
         if (mSlots[i].buffer != NULL &&
-                mSlots[i].buffer->handle == buffer->handle) {
+                mSlots[i].buffer->getId() == buffer->getId()) {
             if (mReportRemovedBuffers) {
                 mRemovedBuffers.push_back(mSlots[i].buffer);
             }