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

Commit 32811fd0 authored by chaviw's avatar chaviw
Browse files

Let Screenshot Parent get destroyed on the main thread.

Currently the reference to Screenshot Parent is held by the
LayerRenderArea class. That object loses its last reference on the
binder thread so the Screenshot Parent is destroyed on the binder
thread. To keep things consistent, it's best if the Layer is destroyed
on the main thread, like other layers.

By removing the reference to Screenshot Parent in LayerRenderArea and
only having a reference in RenderForDrawing, it ensures that the last
reference to the Screenshot Parent is dropped on the main thread.

Test: Screenshot Parent destructor is called on main thread.
Change-Id: I82f641a063102584d0a2eddb8a6b11546ed777b2
parent 4f17282e
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -5645,7 +5645,10 @@ status_t SurfaceFlinger::captureLayers(
                drawLayers();
            } else {
                Rect bounds = getBounds();
                screenshotParentLayer = mFlinger->getFactory().createContainerLayer(
                // In the "childrenOnly" case we reparent the children to a screenshot
                // layer which has no properties set and which does not draw.
                sp<ContainerLayer> screenshotParentLayer =
                        mFlinger->getFactory().createContainerLayer(
                                LayerCreationArgs(mFlinger, nullptr, String8("Screenshot Parent"),
                                                  bounds.getWidth(), bounds.getHeight(), 0,
                                                  LayerMetadata()));
@@ -5659,9 +5662,6 @@ status_t SurfaceFlinger::captureLayers(
        const sp<Layer> mLayer;
        const Rect mCrop;

        // In the "childrenOnly" case we reparent the children to a screenshot
        // layer which has no properties set and which does not draw.
        sp<ContainerLayer> screenshotParentLayer;
        ui::Transform mTransform;
        bool mNeedsFiltering;