libgui: fix an EGLImage leak
This moves the call to ConsumerBase::abandon from the ConsumerBase dtor to
ConsumerBase::onLastStrongRef. The abandon call relies on virtual methods to
perform the clean-up, so calling it from the ConsumerBase dtor after the
derived classes dtors ran was skipping some of the clean-up. The
onLastStrongRef method should get called just before the most derived class's
dtor gets called.
Bug: 8349135
Change-Id: I836946826927cc1ed69c049049f525f92b17a269
diff --git a/libs/gui/tests/SurfaceTextureClient_test.cpp b/libs/gui/tests/SurfaceTextureClient_test.cpp
index ce96036..7376b4c 100644
--- a/libs/gui/tests/SurfaceTextureClient_test.cpp
+++ b/libs/gui/tests/SurfaceTextureClient_test.cpp
@@ -178,21 +178,21 @@
EXPECT_EQ(EGL_SUCCESS, eglGetError());
EGLBoolean success = eglMakeCurrent(mEglDisplay, eglSurface, eglSurface, mEglContext);
- EXPECT_EQ(EGL_TRUE, success);
+ EXPECT_TRUE(success);
glClear(GL_COLOR_BUFFER_BIT);
success = eglSwapBuffers(mEglDisplay, eglSurface);
- EXPECT_EQ(EGL_TRUE, success);
+ EXPECT_TRUE(success);
mST->abandon();
glClear(GL_COLOR_BUFFER_BIT);
success = eglSwapBuffers(mEglDisplay, eglSurface);
- EXPECT_EQ(EGL_FALSE, success);
+ EXPECT_FALSE(success);
EXPECT_EQ(EGL_BAD_SURFACE, eglGetError());
success = eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext);
- ASSERT_EQ(EGL_TRUE, success);
+ ASSERT_TRUE(success);
if (eglSurface != EGL_NO_SURFACE) {
eglDestroySurface(mEglDisplay, eglSurface);