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

Commit 11951841 authored by Stan Iliev's avatar Stan Iliev Committed by Automerger Merge Worker
Browse files

Fix TextureView calling eglCreateImage with a destructed buffer am: df8a0739...

Fix TextureView calling eglCreateImage with a destructed buffer am: df8a0739 am: 9b45d620 am: 3b591f5e

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/12174650

Change-Id: I1ed00719b3dc9c842632d6599347a2e941496a34
parents 924a9b21 3b591f5e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -79,6 +79,8 @@ typedef int (*ASurfaceTexture_fenceWait)(int fence, void* fencePassThroughHandle

/**
 * ASurfaceTexture_dequeueBuffer returns the next available AHardwareBuffer.
 * The caller gets ownership of the buffer and need to release it with
 * AHardwareBuffer_release.
 */
AHardwareBuffer* ASurfaceTexture_dequeueBuffer(ASurfaceTexture* st, int* outSlotid,
                                               android_dataspace* outDataspace,
+9 −1
Original line number Diff line number Diff line
@@ -208,7 +208,15 @@ AHardwareBuffer* ASurfaceTexture_dequeueBuffer(ASurfaceTexture* st, int* outSlot
            *outNewContent = true;
        }
    } while (buffer.get() && (!queueEmpty));
    return reinterpret_cast<AHardwareBuffer*>(buffer.get());
    AHardwareBuffer* result = nullptr;
    if (buffer.get()) {
      result = buffer->toAHardwareBuffer();
      // add a reference to keep the hardware buffer alive, even if
      // BufferQueueProducer is disconnected. This is needed, because
      // sp reference is destroyed at the end of this function.
      AHardwareBuffer_acquire(result);
    }
    return result;
}

} // namespace android