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
diff --git a/libs/gui/BufferQueueProducer.cpp b/libs/gui/BufferQueueProducer.cpp
index 3f4c5da..26784cf 100644
--- a/libs/gui/BufferQueueProducer.cpp
+++ b/libs/gui/BufferQueueProducer.cpp
@@ -1120,8 +1120,9 @@
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();