diff options
author | Mattias Falk <mattias.falk@sonyericsson.com> | 2010-09-16 16:24:46 +0200 |
---|---|---|
committer | Johan Redestig <johan.redestig@sonyericsson.com> | 2010-10-04 13:13:25 +0200 |
commit | 0ae2ec88ec8f170cb5548d52bf89fa744b390991 (patch) | |
tree | f9c73dbe25a5f6643c5a3d429682439d70c31d1a /core | |
parent | 7d9c73fb6f6f79f7f92b77482a0edbd7b89f2564 (diff) | |
download | frameworks_base-0ae2ec88ec8f170cb5548d52bf89fa744b390991.zip frameworks_base-0ae2ec88ec8f170cb5548d52bf89fa744b390991.tar.gz frameworks_base-0ae2ec88ec8f170cb5548d52bf89fa744b390991.tar.bz2 |
Dismissing AlertDialog before destroying WebView.
Added dismiss method for the Alertdialog in destroy to avoid
a leaked window.
Change-Id: Ia6a6e733b8bdd583dae15b854e4d69ef4f5cbff1
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/webkit/WebView.java | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 8e363d6..0ea89a8 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -308,6 +308,10 @@ public class WebView extends AbsoluteLayout // true means redraw the screen all-the-time. Only with AUTO_REDRAW_HACK private boolean mAutoRedraw; + // Reference to the AlertDialog displayed by InvokeListBox. + // It's used to dismiss the dialog in destroy if not done before. + private AlertDialog mListBoxDialog = null; + static final String LOGTAG = "webview"; private static class ExtendedZoomControls extends FrameLayout { @@ -1232,6 +1236,10 @@ public class WebView extends AbsoluteLayout */ public void destroy() { clearTextEntry(false); + if (mListBoxDialog != null) { + mListBoxDialog.dismiss(); + mListBoxDialog = null; + } if (mWebViewCore != null) { // Set the handlers to null before destroying WebViewCore so no // more messages will be posted. @@ -7072,7 +7080,7 @@ public class WebView extends AbsoluteLayout EventHub.SINGLE_LISTBOX_CHOICE, -2, 0); }}); } - final AlertDialog dialog = b.create(); + mListBoxDialog = b.create(); listView.setAdapter(adapter); listView.setFocusableInTouchMode(true); // There is a bug (1250103) where the checks in a ListView with @@ -7094,7 +7102,8 @@ public class WebView extends AbsoluteLayout int position, long id) { mWebViewCore.sendMessage( EventHub.SINGLE_LISTBOX_CHOICE, (int)id, 0); - dialog.dismiss(); + mListBoxDialog.dismiss(); + mListBoxDialog = null; } }); if (mSelection != -1) { @@ -7106,13 +7115,14 @@ public class WebView extends AbsoluteLayout adapter.registerDataSetObserver(observer); } } - dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { + mListBoxDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { public void onCancel(DialogInterface dialog) { mWebViewCore.sendMessage( EventHub.SINGLE_LISTBOX_CHOICE, -2, 0); + mListBoxDialog = null; } }); - dialog.show(); + mListBoxDialog.show(); } } |