Skip to content

Commit fef288b

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

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
@@ -687,6 +687,10 @@ protected void measureContent() {
687687
// It's used to dismiss the dialog in destroy if not done before.
688688
private AlertDialog mListBoxDialog = null;
689689

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

692696
private ZoomManager mZoomManager;
@@ -1836,7 +1840,7 @@ public void setOverScrollMode(int mode) {
18361840
neverRemember.getData().putString("password", password);
18371841
neverRemember.obj = resumeMsg;
18381842

1839-
new AlertDialog.Builder(mContext)
1843+
mSavePasswordDialog = new AlertDialog.Builder(mContext)
18401844
.setTitle(com.android.internal.R.string.save_password_label)
18411845
.setMessage(com.android.internal.R.string.save_password_message)
18421846
.setPositiveButton(com.android.internal.R.string.save_password_notnow,
@@ -1847,6 +1851,7 @@ public void onClick(DialogInterface dialog, int which) {
18471851
resumeMsg.sendToTarget();
18481852
mResumeMsg = null;
18491853
}
1854+
mSavePasswordDialog = null;
18501855
}
18511856
})
18521857
.setNeutralButton(com.android.internal.R.string.save_password_remember,
@@ -1857,6 +1862,7 @@ public void onClick(DialogInterface dialog, int which) {
18571862
remember.sendToTarget();
18581863
mResumeMsg = null;
18591864
}
1865+
mSavePasswordDialog = null;
18601866
}
18611867
})
18621868
.setNegativeButton(com.android.internal.R.string.save_password_never,
@@ -1867,6 +1873,7 @@ public void onClick(DialogInterface dialog, int which) {
18671873
neverRemember.sendToTarget();
18681874
mResumeMsg = null;
18691875
}
1876+
mSavePasswordDialog = null;
18701877
}
18711878
})
18721879
.setOnCancelListener(new OnCancelListener() {
@@ -1876,6 +1883,7 @@ public void onCancel(DialogInterface dialog) {
18761883
resumeMsg.sendToTarget();
18771884
mResumeMsg = null;
18781885
}
1886+
mSavePasswordDialog = null;
18791887
}
18801888
}).show();
18811889
// Return true so that WebViewCore will pause while the dialog is
@@ -2115,6 +2123,10 @@ private void destroyJava() {
21152123
mListBoxDialog.dismiss();
21162124
mListBoxDialog = null;
21172125
}
2126+
if (mSavePasswordDialog != null) {
2127+
mSavePasswordDialog.dismiss();
2128+
mSavePasswordDialog = null;
2129+
}
21182130
if (mWebViewCore != null) {
21192131
// Tell WebViewCore to destroy itself
21202132
synchronized (this) {

0 commit comments

Comments
 (0)