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

Commit 0a068094 authored by Pablo Ceballos's avatar Pablo Ceballos
Browse files

BQ: Handle buffer allocation failure

Return the slot to the mFreeSlots if we fail to allocate.

Bug 29873396

Change-Id: Icafc5c64c7233d47e160f7a56e5a314e4a01611d
parent 2f1eb1c1
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -509,11 +509,15 @@ status_t BufferQueueProducer::dequeueBuffer(int *outSlot,
            mCore->mIsAllocatingCondition.broadcast();

            if (graphicBuffer == NULL) {
                mCore->mFreeSlots.insert(*outSlot);
                mCore->clearBufferSlotLocked(*outSlot);
                BQ_LOGE("dequeueBuffer: createGraphicBuffer failed");
                return error;
            }

            if (mCore->mIsAbandoned) {
                mCore->mFreeSlots.insert(*outSlot);
                mCore->clearBufferSlotLocked(*outSlot);
                BQ_LOGE("dequeueBuffer: BufferQueue has been abandoned");
                return NO_INIT;
            }