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

Commit f10a87bd authored by Vishnu Nair's avatar Vishnu Nair
Browse files

[sf] Fix crash caused by invalid access of mPreviouslyPresentedLayerStacks

While trying to update the release fence for layers with buffer
removed, we incorrectly accessed and updated the same data struct.

Test: presbumit
Fixes: 279397500
Change-Id: I2488da1696774669777e94e23301af6ecc2ae581
parent 38a3e0b7
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -2874,7 +2874,10 @@ void SurfaceFlinger::postComposition(nsecs_t callTime) {
    }

    for (auto layer : mLayersWithBuffersRemoved) {
        for (auto layerStack : layer->mPreviouslyPresentedLayerStacks) {
        std::vector<ui::LayerStack> previouslyPresentedLayerStacks =
                std::move(layer->mPreviouslyPresentedLayerStacks);
        layer->mPreviouslyPresentedLayerStacks.clear();
        for (auto layerStack : previouslyPresentedLayerStacks) {
            auto optDisplay = layerStackToDisplay.get(layerStack);
            if (optDisplay && !optDisplay->get()->isVirtual()) {
                auto fence = getHwComposer().getPresentFence(optDisplay->get()->getPhysicalId());