From 91b539801833012798b1998c30440136add7e7d4 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Thu, 11 Aug 2011 18:18:50 -0700 Subject: SurfaceFlinger doesn't rely on having a custom RefBase destructor we just use a message to the main thread to destroy our GLES state. --- services/surfaceflinger/Layer.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'services/surfaceflinger/Layer.cpp') diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 505c843a64e3..55b354d6c7f0 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -65,14 +65,9 @@ Layer::Layer(SurfaceFlinger* flinger, glGenTextures(1, &mTextureName); } -void Layer::destroy(RefBase const* base) { - mFlinger->destroyLayer(static_cast(base)); -} - void Layer::onFirstRef() { LayerBaseClient::onFirstRef(); - setDestroyer(this); struct FrameQueuedListener : public SurfaceTexture::FrameAvailableListener { FrameQueuedListener(Layer* layer) : mLayer(layer) { } @@ -93,7 +88,16 @@ void Layer::onFirstRef() Layer::~Layer() { - glDeleteTextures(1, &mTextureName); + class MessageDestroyGLState : public MessageBase { + GLuint texture; + public: + MessageDestroyGLState(GLuint texture) : texture(texture) { } + virtual bool handler() { + glDeleteTextures(1, &texture); + return true; + } + }; + mFlinger->postMessageAsync( new MessageDestroyGLState(mTextureName) ); } void Layer::onFrameQueued() { -- cgit v1.2.3-59-g8ed1b