diff --git a/libs/gui/SurfaceTexture.cpp b/libs/gui/SurfaceTexture.cpp index a2aca8f0e..66660810f 100644 --- a/libs/gui/SurfaceTexture.cpp +++ b/libs/gui/SurfaceTexture.cpp @@ -327,9 +327,9 @@ status_t SurfaceTexture::updateTexImage(BufferRejecter* rejecter) { } void SurfaceTexture::setReleaseFence(int fenceFd) { + sp fence(new Fence(fenceFd)); if (fenceFd == -1 || mCurrentTexture == BufferQueue::INVALID_BUFFER_SLOT) return; - sp fence(new Fence(fenceFd)); if (!mEGLSlots[mCurrentTexture].mReleaseFence.get()) { mEGLSlots[mCurrentTexture].mReleaseFence = fence; } else {