summaryrefslogtreecommitdiffstats
path: root/libs/surfaceflinger
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2010-01-21 16:04:56 -0800
committerMathias Agopian <mathias@google.com>2010-01-21 16:29:34 -0800
commit2d41cb9433ef3845560a252a5cf8226e1d78209a (patch)
tree17e90268c8669ce664baf31fee77de124f795b48 /libs/surfaceflinger
parenta1a1798599361f5f1db8fe612606323c801f4f6c (diff)
downloadframeworks_base-2d41cb9433ef3845560a252a5cf8226e1d78209a.zip
frameworks_base-2d41cb9433ef3845560a252a5cf8226e1d78209a.tar.gz
frameworks_base-2d41cb9433ef3845560a252a5cf8226e1d78209a.tar.bz2
fix [2324665] texture leak in surfaceflinger when using camera
Diffstat (limited to 'libs/surfaceflinger')
-rw-r--r--libs/surfaceflinger/LayerBuffer.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/libs/surfaceflinger/LayerBuffer.cpp b/libs/surfaceflinger/LayerBuffer.cpp
index b9727ab..ac9b6b0 100644
--- a/libs/surfaceflinger/LayerBuffer.cpp
+++ b/libs/surfaceflinger/LayerBuffer.cpp
@@ -370,8 +370,23 @@ LayerBuffer::BufferSource::BufferSource(LayerBuffer& layer,
LayerBuffer::BufferSource::~BufferSource()
{
+ class MessageDestroyTexture : public MessageBase {
+ SurfaceFlinger* flinger;
+ GLuint name;
+ public:
+ MessageDestroyTexture(
+ SurfaceFlinger* flinger, GLuint name)
+ : flinger(flinger), name(name) { }
+ virtual bool handler() {
+ glDeleteTextures(1, &name);
+ return true;
+ }
+ };
+
if (mTexture.name != -1U) {
- glDeleteTextures(1, &mTexture.name);
+ // GL textures can only be destroyed from the GL thread
+ mLayer.mFlinger->mEventQueue.postMessage(
+ new MessageDestroyTexture(mLayer.mFlinger.get(), mTexture.name) );
}
if (mTexture.image != EGL_NO_IMAGE_KHR) {
EGLDisplay dpy(mLayer.mFlinger->graphicPlane(0).getEGLDisplay());