diff --git a/libs/gui/SurfaceTexture.cpp b/libs/gui/SurfaceTexture.cpp index 6562a94bb..8141227f8 100644 --- a/libs/gui/SurfaceTexture.cpp +++ b/libs/gui/SurfaceTexture.cpp @@ -351,7 +351,7 @@ status_t SurfaceTexture::detachFromContext() { // new EGLDisplay). for (int i =0; i < BufferQueue::NUM_BUFFER_SLOTS; i++) { EGLImageKHR img = mEGLSlots[i].mEglImage; - if (img != EGL_NO_IMAGE_KHR) { + if (img != EGL_NO_IMAGE_KHR && i != mCurrentTexture) { eglDestroyImageKHR(mEglDisplay, img); mEGLSlots[i].mEglImage = EGL_NO_IMAGE_KHR; }