diff options
| author | 2023-03-22 22:25:28 +0000 | |
|---|---|---|
| committer | 2023-03-29 23:19:14 +0000 | |
| commit | 2cf827faebace4039cb0c0af0def9efdf454af62 (patch) | |
| tree | 11fe2b4400e879c263d94ef895366f4bc95c3b84 | |
| parent | 68ca576a8dcffa5764026a7ca9c9b1090ccd63a3 (diff) | |
Grab lock before reparenting in SurfaceFlinger commitMirrorDisplays()
Bug: 271644537
Test: n/a
Change-Id: I45384210791bd9280f63d95e3bdaef3d299fc818
(cherry picked from commit 9cba62a07f393d852dabf20b6e4d10e67b29c8d9)
Merged-In: I45384210791bd9280f63d95e3bdaef3d299fc818
| -rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 6a2e3475b9..9ceb0afa20 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -7913,9 +7913,14 @@ bool SurfaceFlinger::commitMirrorDisplays(VsyncId vsyncId) { ISurfaceComposerClient::eNoColorFill, gui::LayerMetadata()); sp<Layer> childMirror; - createEffectLayer(mirrorArgs, &unused, &childMirror); - childMirror->setClonedChild(layer->createClone()); - childMirror->reparent(mirrorDisplay.rootHandle); + { + Mutex::Autolock lock(mStateLock); + createEffectLayer(mirrorArgs, &unused, &childMirror); + childMirror->setClonedChild(layer->createClone()); + childMirror->reparent(mirrorDisplay.rootHandle); + } + // lock on mStateLock needs to be released before binder handle gets destroyed + unused.clear(); } } return true; |