OSDN Git Service

SurfaceTexture: detachFromContext fixed
authorDaniel Lam <dalam@google.com>
Thu, 19 Apr 2012 04:29:19 +0000 (21:29 -0700)
committerMathias Agopian <mathias@google.com>
Wed, 25 Apr 2012 00:25:00 +0000 (17:25 -0700)
Fixed AttachToContextSucceeds test SurfaceTexture test by
not deleting the current texture when cleaning up memory.

Bug: 6363186
Change-Id: Ib886bfe6bb86e25ea4825d18b5008afba6b33eae

libs/gui/SurfaceTexture.cpp

index 6562a94..8141227 100644 (file)
@@ -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;
         }