summaryrefslogtreecommitdiff
path: root/libs/surfaceflinger/Layer.cpp
diff options
context:
space:
mode:
author Mathias Agopian <mathias@google.com> 2009-07-02 17:33:40 -0700
committer Mathias Agopian <mathias@google.com> 2009-07-02 18:45:29 -0700
commit759fdb2ef735422d6b8c65e168fa9d1c24562a86 (patch)
tree043f7f5a9288a37b0e888ebb2d537930c154a149 /libs/surfaceflinger/Layer.cpp
parent84d1f7a09827fe195dd08b647b8c5092d03516f7 (diff)
free gralloc buffers as soon as possible (when a surface is not visible any longer), client who have the buffers still mapped won't crash, btu may see garbage data
Diffstat (limited to 'libs/surfaceflinger/Layer.cpp')
-rw-r--r--libs/surfaceflinger/Layer.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/libs/surfaceflinger/Layer.cpp b/libs/surfaceflinger/Layer.cpp
index c40fec16fb..991615800d 100644
--- a/libs/surfaceflinger/Layer.cpp
+++ b/libs/surfaceflinger/Layer.cpp
@@ -76,7 +76,9 @@ void Layer::destroy()
eglDestroyImageKHR(dpy, mTextures[i].image);
mTextures[i].image = EGL_NO_IMAGE_KHR;
}
+ mBuffers[i].free();
}
+ mSurface.clear();
}
void Layer::initStates(uint32_t w, uint32_t h, uint32_t flags)
@@ -95,7 +97,6 @@ sp<LayerBaseClient::Surface> Layer::createSurface() const
status_t Layer::ditch()
{
// the layer is not on screen anymore. free as much resources as possible
- mSurface.clear();
destroy();
return NO_ERROR;
}