diff options
author | Dianne Hackborn <hackbod@google.com> | 2011-01-03 13:58:14 -0800 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2011-01-03 13:58:14 -0800 |
commit | 8b4cac1f420d2e6d235511015a6ab65db5ebaca4 (patch) | |
tree | ec0e79eacfc7c21e8c455d99539a74873b6c3adc /core | |
parent | 003f338b6f12400429c5d8f0fc06a477a7ce1f80 (diff) | |
download | frameworks_base-8b4cac1f420d2e6d235511015a6ab65db5ebaca4.zip frameworks_base-8b4cac1f420d2e6d235511015a6ab65db5ebaca4.tar.gz frameworks_base-8b4cac1f420d2e6d235511015a6ab65db5ebaca4.tar.bz2 |
Again maybe fix issue #3169193...
...com.google.android.youtube: java.lang.NullPointerException at
com.google.android.youtube.async.UserAuthorizer$3.onCancel(UserAuthorizer.java:324)
Only perform one cancel callback for a particular start of the dialog.
Change-Id: Ib448fcae2489a63c9b63affdc518658447e90920
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/app/Dialog.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/core/java/android/app/Dialog.java b/core/java/android/app/Dialog.java index c398e98..e69e664 100644 --- a/core/java/android/app/Dialog.java +++ b/core/java/android/app/Dialog.java @@ -25,7 +25,6 @@ import android.content.ContextWrapper; import android.content.DialogInterface; import android.graphics.drawable.Drawable; import android.net.Uri; -import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.os.Message; @@ -101,6 +100,7 @@ public class Dialog implements DialogInterface, Window.Callback, private boolean mCreated = false; private boolean mShowing = false; + private boolean mCanceled = false; private final Thread mUiThread; private final Handler mHandler = new Handler(); @@ -244,6 +244,8 @@ public class Dialog implements DialogInterface, Window.Callback, return; } + mCanceled = false; + if (!mCreated) { dispatchOnCreate(null); } @@ -997,7 +999,8 @@ public class Dialog implements DialogInterface, Window.Callback, * also call your {@link DialogInterface.OnCancelListener} (if registered). */ public void cancel() { - if (mCancelMessage != null) { + if (!mCanceled && mCancelMessage != null) { + mCanceled = true; // Obtain a new message so this dialog can be re-used Message.obtain(mCancelMessage).sendToTarget(); } |