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

Commit 92be82e6 authored by Romain Guy's avatar Romain Guy
Browse files

Prevent crash when dismissing a PopupWindow that didn't have time to show up.

Bug #2520981

This is very similar to recent crashes we fixed in Dialogs.

Change-Id: Ifd85f05ddc3843ef727ca92808568a5520c83107
parent 4f43ae09
Loading
Loading
Loading
Loading
+12 −10
Original line number Diff line number Diff line
@@ -1048,8 +1048,9 @@ public class PopupWindow {
        if (isShowing() && mPopupView != null) {
            unregisterForScrollChanged();

            try {
                mWindowManager.removeView(mPopupView);                

            } finally {
                if (mPopupView != mContentView && mPopupView instanceof ViewGroup) {
                    ((ViewGroup) mPopupView).removeView(mContentView);
                }
@@ -1061,6 +1062,7 @@ public class PopupWindow {
                }
            }
        }
    }

    /**
     * Sets the listener to be called when the window is dismissed.