Skip to content

Commit 8f58dfa

Browse files
John ReckAndroid Git Automerger
authored andcommitted
am da5cd30: am ae03afd: Merge "onSavePassword dialog can leak when WebViewClassic is destroyed."
* commit 'da5cd308028f8f6863bbe3631de91b96802695ec': onSavePassword dialog can leak when WebViewClassic is destroyed.
2 parents 044a9b9 + da5cd30 commit 8f58dfa

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

core/java/android/webkit/WebViewClassic.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,10 @@ protected void measureContent() {
686686
// It's used to dismiss the dialog in destroy if not done before.
687687
private AlertDialog mListBoxDialog = null;
688688

689+
// Reference to the save password dialog so it can be dimissed in
690+
// destroy if not done before.
691+
private AlertDialog mSavePasswordDialog = null;
692+
689693
static final String LOGTAG = "webview";
690694

691695
private ZoomManager mZoomManager;
@@ -1811,7 +1815,7 @@ public void setOverScrollMode(int mode) {
18111815
neverRemember.getData().putString("password", password);
18121816
neverRemember.obj = resumeMsg;
18131817

1814-
new AlertDialog.Builder(mContext)
1818+
mSavePasswordDialog = new AlertDialog.Builder(mContext)
18151819
.setTitle(com.android.internal.R.string.save_password_label)
18161820
.setMessage(com.android.internal.R.string.save_password_message)
18171821
.setPositiveButton(com.android.internal.R.string.save_password_notnow,
@@ -1822,6 +1826,7 @@ public void onClick(DialogInterface dialog, int which) {
18221826
resumeMsg.sendToTarget();
18231827
mResumeMsg = null;
18241828
}
1829+
mSavePasswordDialog = null;
18251830
}
18261831
})
18271832
.setNeutralButton(com.android.internal.R.string.save_password_remember,
@@ -1832,6 +1837,7 @@ public void onClick(DialogInterface dialog, int which) {
18321837
remember.sendToTarget();
18331838
mResumeMsg = null;
18341839
}
1840+
mSavePasswordDialog = null;
18351841
}
18361842
})
18371843
.setNegativeButton(com.android.internal.R.string.save_password_never,
@@ -1842,6 +1848,7 @@ public void onClick(DialogInterface dialog, int which) {
18421848
neverRemember.sendToTarget();
18431849
mResumeMsg = null;
18441850
}
1851+
mSavePasswordDialog = null;
18451852
}
18461853
})
18471854
.setOnCancelListener(new OnCancelListener() {
@@ -1851,6 +1858,7 @@ public void onCancel(DialogInterface dialog) {
18511858
resumeMsg.sendToTarget();
18521859
mResumeMsg = null;
18531860
}
1861+
mSavePasswordDialog = null;
18541862
}
18551863
}).show();
18561864
// Return true so that WebViewCore will pause while the dialog is
@@ -2090,6 +2098,10 @@ private void destroyJava() {
20902098
mListBoxDialog.dismiss();
20912099
mListBoxDialog = null;
20922100
}
2101+
if (mSavePasswordDialog != null) {
2102+
mSavePasswordDialog.dismiss();
2103+
mSavePasswordDialog = null;
2104+
}
20932105
if (mWebViewCore != null) {
20942106
// Tell WebViewCore to destroy itself
20952107
synchronized (this) {

0 commit comments

Comments
 (0)