summaryrefslogtreecommitdiffstats
path: root/libs/surfaceflinger/SurfaceFlinger.cpp
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2009-06-19 16:24:02 -0700
committerMathias Agopian <mathias@google.com>2009-06-19 16:24:02 -0700
commitc8fb5b1979da4829e1486e6a1008c06c979b94b0 (patch)
tree80845ce609dd0f506069e5817b8bb6fbb2d4ba48 /libs/surfaceflinger/SurfaceFlinger.cpp
parent09cf0ac2e9ec9e18c7099312265f9d51cdbb0f37 (diff)
downloadframeworks_base-c8fb5b1979da4829e1486e6a1008c06c979b94b0.zip
frameworks_base-c8fb5b1979da4829e1486e6a1008c06c979b94b0.tar.gz
frameworks_base-c8fb5b1979da4829e1486e6a1008c06c979b94b0.tar.bz2
release the last reference to surfaces explicitely instead of letting it go implicitely when the message is destroyed
Diffstat (limited to 'libs/surfaceflinger/SurfaceFlinger.cpp')
-rw-r--r--libs/surfaceflinger/SurfaceFlinger.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/libs/surfaceflinger/SurfaceFlinger.cpp b/libs/surfaceflinger/SurfaceFlinger.cpp
index a56ecd8..90e0bb5 100644
--- a/libs/surfaceflinger/SurfaceFlinger.cpp
+++ b/libs/surfaceflinger/SurfaceFlinger.cpp
@@ -1322,6 +1322,8 @@ status_t SurfaceFlinger::destroySurface(const sp<LayerBaseClient>& layer)
SurfaceFlinger* flinger, const sp<LayerBaseClient>& layer)
: flinger(flinger), layer(layer) { }
virtual bool handler() {
+ sp<LayerBaseClient> l(layer);
+ layer.clear(); // clear it outside of the lock;
Mutex::Autolock _l(flinger->mStateLock);
// remove the layer from the current list -- chances are that it's
// not in the list anyway, because it should have been removed
@@ -1329,7 +1331,7 @@ status_t SurfaceFlinger::destroySurface(const sp<LayerBaseClient>& layer)
// However, a buggy client could have not done that.
// Since we know we don't have any more clients, we don't need
// to use the purgatory.
- status_t err = flinger->removeLayer_l(layer);
+ status_t err = flinger->removeLayer_l(l);
if (err == NAME_NOT_FOUND) {
// The surface wasn't in the current list, which means it was
// removed already, which means it is in the purgatory,
@@ -1338,9 +1340,9 @@ status_t SurfaceFlinger::destroySurface(const sp<LayerBaseClient>& layer)
// must run from there (b/c of OpenGL ES). Additionally, we
// can't really acquire our internal lock from
// destroySurface() -- see postMessage() below.
- ssize_t idx = flinger->mLayerPurgatory.remove(layer);
+ ssize_t idx = flinger->mLayerPurgatory.remove(l);
LOGE_IF(idx < 0,
- "layer=%p is not in the purgatory list", layer.get());
+ "layer=%p is not in the purgatory list", l.get());
}
return true;
}