OSDN Git Service

Fix a race-condtion in SurfaceFlinger that could lead to a crash.
authorMathias Agopian <mathias@google.com>
Tue, 3 May 2011 23:21:41 +0000 (16:21 -0700)
committerMathias Agopian <mathias@google.com>
Mon, 23 May 2011 23:12:02 +0000 (16:12 -0700)
commit02cf75e0ca7e37c0f92b31d965eb41006d849962
tree585a5bd417fb04373d66128cc6d193c3cc6979bc
parent8949eabac7bdbd8bb17aeae6bd8bd23a0c63f2b9
Fix a race-condtion in SurfaceFlinger that could lead to a crash.

Client::mLayers could be accessed from different threads.
On one side from Client::attachLayer() which is currently
called from a binder thread; on the other side from
Client::detachLayer() which is always called from the main
thread.

This could lead to a corruption of Client::mLayers.

We fix this issue by adding an internal lock to Client.

Bug: 4483046

Change-Id: I5262bf1124d9a65ec6f8ffd8e367356fc33a7536
services/surfaceflinger/SurfaceFlinger.cpp
services/surfaceflinger/SurfaceFlinger.h