diff options
author | Mathias Agopian <mathias@google.com> | 2010-01-21 16:04:56 -0800 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2010-01-21 16:29:34 -0800 |
commit | edfd97c0f2e679e86699a0f6c4df65ea21ecff15 (patch) | |
tree | 45a7fb9ad27b7031e2ca5cfd26552aa10e4853a3 /libs/surfaceflinger/LayerBuffer.cpp | |
parent | 8c3b597aa7a627ab6979e58a173502cc505cb0df (diff) | |
download | frameworks_native-edfd97c0f2e679e86699a0f6c4df65ea21ecff15.zip frameworks_native-edfd97c0f2e679e86699a0f6c4df65ea21ecff15.tar.gz frameworks_native-edfd97c0f2e679e86699a0f6c4df65ea21ecff15.tar.bz2 |
fix [2324665] texture leak in surfaceflinger when using camera
Diffstat (limited to 'libs/surfaceflinger/LayerBuffer.cpp')
-rw-r--r-- | libs/surfaceflinger/LayerBuffer.cpp | 17 |
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()); |