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

Commit 745163a6 authored by Alec Mouri's avatar Alec Mouri
Browse files

Don't double close file descriptor in DisplayDevice::queueBuffer.

Bug: 120498887
Test: Builds
Change-Id: Iff4250a501dae0ec1922847c3591bf6f5eb3b305
parent d653633b
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -412,10 +412,9 @@ void DisplayDevice::queueBuffer(HWComposer& hwc) {
        if (mGraphicBuffer == nullptr) {
            ALOGE("No buffer is ready for display [%s]", mDisplayName.c_str());
        } else {
            int fd = mBufferReady.release();

            status_t res = mNativeWindow->queueBuffer(mNativeWindow.get(),
                                                      mGraphicBuffer->getNativeBuffer(), fd);
                                                      mGraphicBuffer->getNativeBuffer(),
                                                      dup(mBufferReady));
            if (res != NO_ERROR) {
                ALOGE("Error when queueing buffer for display [%s]: %d", mDisplayName.c_str(), res);
                // We risk blocking on dequeueBuffer if the primary display failed
@@ -424,9 +423,12 @@ void DisplayDevice::queueBuffer(HWComposer& hwc) {
                    LOG_ALWAYS_FATAL("ANativeWindow::queueBuffer failed with error: %d", res);
                } else {
                    mNativeWindow->cancelBuffer(mNativeWindow.get(),
                                                mGraphicBuffer->getNativeBuffer(), fd);
                                                mGraphicBuffer->getNativeBuffer(),
                                                dup(mBufferReady));
                }
            }

            mBufferReady.reset();
            mGraphicBuffer = nullptr;
        }
    }