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

Commit b9c44aae authored by chaviw's avatar chaviw Committed by Chavi Weingarten
Browse files

Fix Display SurfaceControl leak

The DisplayContent was merging its transaction into the
RootWindowContainer's pendingTransaction. However, that transaction is
never applied so it was stuck in that transaction forever.

There's no need to merge to parent transaction when removing since
calling getPendingTransaction will already return the DisplayContent's
transaction.

Also added a forced Transaction.apply() when removing the DisplayContent
since there's a chance it may no be reachable when
performSurfacePlacement is called to apply all transactions.

Test: EncodeVirtualDisplayWithCompositionTest#testVirtualDisplayRecycles
No longer leaks SurfaceControls
Fixes: 149526716

Change-Id: I14aa5b2e0e14d75fb0285a1b7a511235064f621c
(cherry picked from commit 93938469)
parent fd2f367d
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -2718,6 +2718,9 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
            mRemovingDisplay = false;
        }

        // Apply the pending transaction here since we may not be able to reach the DisplayContent
        // on the next traversal if it's removed from RootWindowContainer child list.
        getPendingTransaction().apply();
        mWmService.mWindowPlacerLocked.requestTraversal();
    }

+0 −7
Original line number Diff line number Diff line
@@ -524,13 +524,6 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<

        if (mSurfaceControl != null) {
            getPendingTransaction().remove(mSurfaceControl);

            // Merge to parent transaction to ensure the transactions on this WindowContainer are
            // applied in native even if WindowContainer is removed.
            if (mParent != null) {
                mParent.getPendingTransaction().merge(getPendingTransaction());
            }

            setSurfaceControl(null);
            mLastSurfacePosition.set(0, 0);
            scheduleAnimation();