summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorJesse Hall <jessehall@google.com>2011-12-02 18:35:54 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2011-12-02 18:35:54 -0800
commit43bfe7f047668a5b74fefb8cfecbf070f637201b (patch)
tree4bbc813041994450745aa451e90c8fed6cbf365b /services
parentaf2eab228536ddc34e14dbada26040cdb1de26ea (diff)
parent19a586f70ad80fa6e7dc83cbdcdb9a1e82431917 (diff)
downloadframeworks_native-43bfe7f047668a5b74fefb8cfecbf070f637201b.zip
frameworks_native-43bfe7f047668a5b74fefb8cfecbf070f637201b.tar.gz
frameworks_native-43bfe7f047668a5b74fefb8cfecbf070f637201b.tar.bz2
am a91e54fe: am f57c1388: Merge "SurfaceFlinger: fix layer removal race condition" into ics-mr1
* commit 'a91e54fed6a0690d59c97bab9b081b2614880563': SurfaceFlinger: fix layer removal race condition
Diffstat (limited to 'services')
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp10
-rw-r--r--services/surfaceflinger/SurfaceFlinger.h1
2 files changed, 10 insertions, 1 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 51c2be8..58196d8 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -720,6 +720,14 @@ void SurfaceFlinger::computeVisibleRegions(
void SurfaceFlinger::commitTransaction()
{
+ if (!mLayersPendingRemoval.isEmpty()) {
+ // Notify removed layers now that they can't be drawn from
+ for (size_t i = 0; i < mLayersPendingRemoval.size(); i++) {
+ mLayersPendingRemoval[i]->onRemoved();
+ }
+ mLayersPendingRemoval.clear();
+ }
+
mDrawingState = mCurrentState;
mTransationPending = false;
mTransactionCV.broadcast();
@@ -1172,7 +1180,7 @@ status_t SurfaceFlinger::purgatorizeLayer_l(const sp<LayerBase>& layerBase)
mLayerPurgatory.add(layerBase);
}
- layerBase->onRemoved();
+ mLayersPendingRemoval.push(layerBase);
// it's possible that we don't find a layer, because it might
// have been destroyed already -- this is not technically an error
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 1039f47..e6d2cd9 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -352,6 +352,7 @@ private:
Condition mTransactionCV;
SortedVector< sp<LayerBase> > mLayerPurgatory;
bool mTransationPending;
+ Vector< sp<LayerBase> > mLayersPendingRemoval;
// protected by mStateLock (but we could use another lock)
GraphicPlane mGraphicPlanes[1];