summaryrefslogtreecommitdiffstats
path: root/libs/surfaceflinger/Layer.cpp
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2009-07-02 17:33:40 -0700
committerMathias Agopian <mathias@google.com>2009-07-02 18:45:29 -0700
commit359140c171f67b9b29a1beae9743b49d0759414b (patch)
treeec5255d464b929e5396c3fb29cefd862f818e982 /libs/surfaceflinger/Layer.cpp
parentdfe983bd7979ccb1602f29b8f9804c98411d9cd6 (diff)
downloadframeworks_base-359140c171f67b9b29a1beae9743b49d0759414b.zip
frameworks_base-359140c171f67b9b29a1beae9743b49d0759414b.tar.gz
frameworks_base-359140c171f67b9b29a1beae9743b49d0759414b.tar.bz2
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 c40fec1..9916158 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;
}