Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 6852bff7 authored by chaviw's avatar chaviw
Browse files

Remove root layer when clearing mLayersPendingRemoval

The previous code removed the root layer from layersSortedByZ when the
Layer handle was destroyed. However this causes issues if the Layer is
created and then dropped quickly on the client side. What happened was
the following:

1. Client creates a Layer
2. SF creates the Layer, but doesn't add it to the hierarchy yet
3. Client drops the Layer reference
4. LayerCleaner dtor is called which calls SF#onHandleDestroyed. This
   removed the Layer from layersSortedByZ and added it to mLayersPendingRemoval
5. SF main thread runs and adds the Layer to the hierarchy. So for the
   case of root, it adds it to layersSortedByZ
6. mLayersPendingRemoval is traversed and cleared, but since layersSortedByZ still
   has a reference to the Layer, it's never destroyed.

With this change, the Layer will be created, but then removed from layersSortedByZ
when mLayersPendingRemoval is traversed. That way the Layer reference
can be dropped.

Test: SurfaceFlingerStress#create_and_destroy
Fixes: 229754763
Change-Id: I0537781d6e13fbdeb2502ed6a7e65dbcfd7b28ce
parent 9fdc02c7
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment