summaryrefslogtreecommitdiff
path: root/libs/gui/GLConsumer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/gui/GLConsumer.cpp')
-rw-r--r--libs/gui/GLConsumer.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/libs/gui/GLConsumer.cpp b/libs/gui/GLConsumer.cpp
index 1572a89222..83e4d66412 100644
--- a/libs/gui/GLConsumer.cpp
+++ b/libs/gui/GLConsumer.cpp
@@ -424,6 +424,11 @@ status_t GLConsumer::updateAndReleaseLocked(const BufferItem& item)
mCurrentTextureImage->graphicBufferHandle() : 0,
slot, mSlots[slot].mGraphicBuffer->handle);
+ // Hang onto the pointer so that it isn't freed in the call to
+ // releaseBufferLocked() if we're in single buffer mode and both buffers are
+ // the same.
+ sp<EglImage> nextTextureImage = mEglSlots[slot].mEglImage;
+
// release old buffer
if (mCurrentTexture != BufferQueue::INVALID_BUFFER_SLOT) {
status_t status = releaseBufferLocked(
@@ -439,7 +444,7 @@ status_t GLConsumer::updateAndReleaseLocked(const BufferItem& item)
// Update the GLConsumer state.
mCurrentTexture = slot;
- mCurrentTextureImage = mEglSlots[slot].mEglImage;
+ mCurrentTextureImage = nextTextureImage;
mCurrentCrop = item.mCrop;
mCurrentTransform = item.mTransform;
mCurrentScalingMode = item.mScalingMode;