diff options
| author | 2020-04-20 15:09:35 -0700 | |
|---|---|---|
| committer | 2020-04-20 15:11:32 -0700 | |
| commit | a0aeedc3baefdb4c5150a48ed669f063bff8aa8c (patch) | |
| tree | 85e39c12b5022242607c82e23ce214ed58893a87 /libs/gui/BufferQueueProducer.cpp | |
| parent | 9bb4cfb009f1317605e8ff090e0ce930e15d4d40 (diff) | |
BufferQueueProducer: Slot may have null buffer [2/2].
I'm not entirely sure how we got in to this state
but it seems best not to crash. It seems like we
are tearing down and everything will work out
in the end anyway. This contains the fix to cancelBuffer
that was supposed to be in the first CL.
Bug: 153913134
Test: Existing tests pass
Change-Id: Ie6f17d43e044e18be03e6c477ca8bc0495cee0a1
Diffstat (limited to 'libs/gui/BufferQueueProducer.cpp')
| -rw-r--r-- | libs/gui/BufferQueueProducer.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libs/gui/BufferQueueProducer.cpp b/libs/gui/BufferQueueProducer.cpp index 3f4c5da193..26784cf14e 100644 --- a/libs/gui/BufferQueueProducer.cpp +++ b/libs/gui/BufferQueueProducer.cpp @@ -1120,8 +1120,9 @@ status_t BufferQueueProducer::cancelBuffer(int slot, const sp<Fence>& fence) { mCore->mFreeBuffers.push_back(slot); } - if (mCore->mConsumerListener != nullptr) { - mCore->mConsumerListener->onFrameCancelled(mSlots[slot].mGraphicBuffer->getId()); + auto gb = mSlots[slot].mGraphicBuffer; + if (mCore->mConsumerListener != nullptr && gb != nullptr) { + mCore->mConsumerListener->onFrameCancelled(gb->getId()); } mSlots[slot].mFence = fence; mCore->mDequeueCondition.notify_all(); |