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

Commit efc3c1a4 authored by Evan Rosky's avatar Evan Rosky
Browse files

Fix clean-up order when player crashes

If the player crashes, its binder death will trigger some clean-up.
There was a bug in the clean-up code though since the clean-up
routines on these objects can also remove themselves from the iterating
list. This reverses the iteration order.

Bug: 304929146
Test: crash sysui with >1 queued transitions
Change-Id: Icbee54a6f72ee110216fc11ea88b8ef93e3a9c0e
parent 66c0d06e
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -271,13 +271,14 @@ class TransitionController {
        if (mTransitionPlayer == null) return;
        // Immediately set to null so that nothing inadvertently starts/queues.
        mTransitionPlayer = null;
        // Clean-up/finish any playing transitions.
        for (int i = 0; i < mPlayingTransitions.size(); ++i) {
        // Clean-up/finish any playing transitions. Backwards since they can remove themselves.
        for (int i = mPlayingTransitions.size() - 1; i >= 0; --i) {
            mPlayingTransitions.get(i).cleanUpOnFailure();
        }
        mPlayingTransitions.clear();
        // Clean up waiting transitions first since they technically started first.
        for (int i = 0; i < mWaitingTransitions.size(); ++i) {
        // Backwards since they can remove themselves.
        for (int i = mWaitingTransitions.size() - 1; i >= 0; --i) {
            mWaitingTransitions.get(i).abort();
        }
        mWaitingTransitions.clear();