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

Commit 92098c7c authored by Craig Mautner's avatar Craig Mautner
Browse files

Dismiss immediately to maintain consistent state.

Fix bug introduced by deferring nulling of mParent.

In dismissDialog the removal was being put on a queue while the
state of the Dialog was being updated immediately. This meant that
if a show() was called before the remove was executed it would try
and add the DecorView a second time. Boom!

Fixes bug 9370301.

Change-Id: I576d1e207c786bc2e21dfd40cb94f2b63a020fe2
parent be4e6aaa
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -306,6 +306,7 @@ public class Dialog implements DialogInterface, Window.Callback,
     * method to do cleanup when the dialog is dismissed, instead implement
     * that in {@link #onStop}.
     */
    @Override
    public void dismiss() {
        if (Looper.myLooper() == mHandler.getLooper()) {
            dismissDialog();
@@ -325,7 +326,7 @@ public class Dialog implements DialogInterface, Window.Callback,
        }

        try {
            mWindowManager.removeView(mDecor);
            mWindowManager.removeViewImmediate(mDecor);
        } finally {
            if (mActionMode != null) {
                mActionMode.finish();
+3 −5
Original line number Diff line number Diff line
@@ -335,15 +335,13 @@ public final class WindowManagerGlobal {
            }
        }
        root.die(immediate);
    }

    void doRemoveView(ViewRootImpl root) {
        synchronized (mLock) {
            final View view = root.getView();
        if (view != null) {
            view.assignParent(null);
        }
    }

    void doRemoveView(ViewRootImpl root) {
        synchronized (mLock) {
            final int index = mRoots.indexOf(root);
            if (index >= 0) {
                mRoots.remove(index);