diff options
| author | 2013-06-10 11:27:26 -0700 | |
|---|---|---|
| committer | 2013-06-10 11:39:21 -0700 | |
| commit | 92098c7c30bc76310a066b220e625fa9aa4b925d (patch) | |
| tree | c3fdb07fba38dea942861d1df26a25b8ec27e661 | |
| parent | be4e6aaa0252dd7da28b7aa85beba982538efa46 (diff) | |
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
| -rw-r--r-- | core/java/android/app/Dialog.java | 5 | ||||
| -rw-r--r-- | core/java/android/view/WindowManagerGlobal.java | 8 |
2 files changed, 6 insertions, 7 deletions
diff --git a/core/java/android/app/Dialog.java b/core/java/android/app/Dialog.java index 634fa30c1c40..cda2c5f3b7c5 100644 --- a/core/java/android/app/Dialog.java +++ b/core/java/android/app/Dialog.java @@ -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(); @@ -334,7 +335,7 @@ public class Dialog implements DialogInterface, Window.Callback, mWindow.closeAllPanels(); onStop(); mShowing = false; - + sendDismissMessage(); } } diff --git a/core/java/android/view/WindowManagerGlobal.java b/core/java/android/view/WindowManagerGlobal.java index 6bcf863aa6e6..f7b85cc7436c 100644 --- a/core/java/android/view/WindowManagerGlobal.java +++ b/core/java/android/view/WindowManagerGlobal.java @@ -335,15 +335,13 @@ public final class WindowManagerGlobal { } } root.die(immediate); + if (view != null) { + view.assignParent(null); + } } void doRemoveView(ViewRootImpl root) { synchronized (mLock) { - final View view = root.getView(); - if (view != null) { - view.assignParent(null); - } - final int index = mRoots.indexOf(root); if (index >= 0) { mRoots.remove(index); |