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

Commit ca7a9da7 authored by John Reck's avatar John Reck
Browse files

Detach disappearing children in onDetach

 Bug: 13324881

Change-Id: Iba6501b164842c5786a6f4763e334e6c80c6fa41
parent 24ba99c2
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -2637,6 +2637,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
        for (int i = 0; i < count; i++) {
            children[i].dispatchDetachedFromWindow();
        }
        clearDisappearingChildren();
        super.dispatchDetachedFromWindow();
    }

@@ -5304,8 +5305,17 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
     * this if you don't want animations for exiting views to stack up.
     */
    public void clearDisappearingChildren() {
        if (mDisappearingChildren != null) {
            mDisappearingChildren.clear();
        final ArrayList<View> disappearingChildren = mDisappearingChildren;
        if (disappearingChildren != null) {
            final int count = disappearingChildren.size();
            for (int i = 0; i < count; i++) {
                final View view = disappearingChildren.get(i);
                if (view.mAttachInfo != null) {
                    view.dispatchDetachedFromWindow();
                }
                view.clearAnimation();
            }
            disappearingChildren.clear();
            invalidate();
        }
    }