summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Huihong Luo <huisinro@google.com> 2021-04-02 10:45:50 -0700
committer Huihong Luo <huisinro@google.com> 2021-04-02 16:19:07 -0700
commitc8c05ed350e0ae43f81c064d674f3d723cd4ed8c (patch)
treede73d53d6b6457c5ff957cd4145f24d910277f54
parent33324ae8ea06ba70f6bb39267ed70567a347d0d1 (diff)
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
-rw-r--r--services/surfaceflinger/CompositionEngine/src/planner/CachedSet.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/services/surfaceflinger/CompositionEngine/src/planner/CachedSet.cpp b/services/surfaceflinger/CompositionEngine/src/planner/CachedSet.cpp
index f58addb70b..5516905d65 100644
--- a/services/surfaceflinger/CompositionEngine/src/planner/CachedSet.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/planner/CachedSet.cpp
@@ -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,