From 9c01b88add21146637b580a3254c11cc735e82e4 Mon Sep 17 00:00:00 2001 From: Jesse Hall Date: Fri, 22 Jun 2012 10:49:59 -0700 Subject: Fix tex and EGLImage leak in ColorBuffer ColorBuffer wasn't destroying its blit texture and associated EGLImage, leaking one pair per Android gralloc buffer. Change-Id: I2fa42d2ecbb654edca7b224bd002d7513a08a633 http://code.google.com/p/android/issues/detail?id=33445 --- emulator/opengl/host/libs/libOpenglRender/ColorBuffer.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/emulator/opengl/host/libs/libOpenglRender/ColorBuffer.cpp b/emulator/opengl/host/libs/libOpenglRender/ColorBuffer.cpp index 218f32b..681db8b 100644 --- a/emulator/opengl/host/libs/libOpenglRender/ColorBuffer.cpp +++ b/emulator/opengl/host/libs/libOpenglRender/ColorBuffer.cpp @@ -111,7 +111,9 @@ ColorBuffer *ColorBuffer::create(int p_width, int p_height, ColorBuffer::ColorBuffer() : m_tex(0), + m_blitTex(0), m_eglImage(NULL), + m_blitEGLImage(NULL), m_fbo(0), m_internalFormat(0), m_warYInvertBug(false) @@ -134,13 +136,21 @@ ColorBuffer::~ColorBuffer() { FrameBuffer *fb = FrameBuffer::getFB(); fb->bind_locked(); - s_gl.glDeleteTextures(1, &m_tex); + + if (m_blitEGLImage) { + s_egl.eglDestroyImageKHR(fb->getDisplay(), m_blitEGLImage); + } if (m_eglImage) { s_egl.eglDestroyImageKHR(fb->getDisplay(), m_eglImage); } + if (m_fbo) { s_gl.glDeleteFramebuffersOES(1, &m_fbo); } + + GLuint tex[2] = {m_tex, m_blitTex}; + s_gl.glDeleteTextures(2, tex); + fb->unbind_locked(); } -- cgit v1.1