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

Commit 7fcbd237 authored by vadimt's avatar vadimt Committed by Vadim Tryshev
Browse files

Fixing activity leak on config change

If attachTo happens before the view is attached to window,
ViewOnDrawExecutor hooks to the tree observer twice (second time from
onViewAttachedToWindow). It only unhooks once.

Since tree observer is global, this leads to leaking the activity, and
besides, all old activities getting the events from the tree observer.

Bug: 139137636
Change-Id: Ie2641b8f3614545052fe34ad6588b070c3b82a33
(cherry picked from commit ebb5c753)
parent c3a688a9
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -55,8 +55,10 @@ public class ViewOnDrawExecutor implements Executor, OnDrawListener, Runnable,
            mLoadAnimationCompleted = true;
        }

        if (mAttachedView.isAttachedToWindow()) {
            attachObserver();
        }
    }

    private void attachObserver() {
        if (!mCompleted) {