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

Commit c8c05ed3 authored by Huihong Luo's avatar Huihong Luo
Browse files

Fix a potential memory crash for layer debug highlighting

Move local variable to the outer scope as its pointer is used inside the vector declared in this scope.

Bug: 184392945
Test: setprop debug.sf.layer_caching_highlight property
Change-Id: I9dc8ff16e0b9aa78138141e7abeee600cc8280f0
parent 33324ae8
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -178,6 +178,7 @@ void CachedSet::render(renderengine::RenderEngine& renderEngine,
    };

    std::vector<renderengine::LayerSettings> layerSettings;
    renderengine::LayerSettings highlight;
    for (const auto& layer : mLayers) {
        const auto clientCompositionList =
                layer.getState()->getOutputLayer()->getLayerFE().prepareClientCompositionList(
@@ -192,7 +193,7 @@ void CachedSet::render(renderengine::RenderEngine& renderEngine,
                   [](const renderengine::LayerSettings& settings) { return &settings; });

    if (sDebugHighlighLayers) {
        renderengine::LayerSettings highlight{
        highlight = {
                .geometry =
                        renderengine::Geometry{
                                .boundaries = FloatRect(0.0f, 0.0f,