aboutsummaryrefslogtreecommitdiffstats
path: root/emulator
diff options
context:
space:
mode:
authorJesse Hall <jessehall@google.com>2012-06-22 10:49:59 -0700
committerJesse Hall <jessehall@google.com>2012-06-25 11:30:14 -0700
commit9c01b88add21146637b580a3254c11cc735e82e4 (patch)
treed391659adc35cd50e01e8cb488e0697ce2844992 /emulator
parent774886faa2fe01e788140c257753a7387c889705 (diff)
downloadsdk-9c01b88add21146637b580a3254c11cc735e82e4.zip
sdk-9c01b88add21146637b580a3254c11cc735e82e4.tar.gz
sdk-9c01b88add21146637b580a3254c11cc735e82e4.tar.bz2
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
Diffstat (limited to 'emulator')
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/ColorBuffer.cpp12
1 files changed, 11 insertions, 1 deletions
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();
}