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

Commit 3851225f authored by Chia-I Wu's avatar Chia-I Wu
Browse files

surfaceflinger: clear HWC layers in Layer::onRemoved v2

Explicitly destroy HWC layers in Layer::onRemoved rather than doing
that implicitly in the destructor.  The layer may be destructed by
any thread that holds a sp<Layer>, but only the main thread should
talk to the composer.

v2 fixes build breakage for non-HWC2 targets.

Bug: 38151478
Bug: 37978067
Test: manual
Change-Id: I8858fc46de1fc6facded219740b931c6486e317e
parent fb8cedea
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -296,6 +296,11 @@ void Layer::onRemoved() {
    }

    mSurfaceFlingerConsumer->abandon();

#ifdef USE_HWC2
    clearHwcLayers();
#endif

    for (const auto& child : mCurrentChildren) {
        child->onRemoved();
    }