Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3170)

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwContents.java

Issue 1845073002: [Merge M50] Ensure that native WindowAndroid outlives native AwContents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/java/src/org/chromium/android_webview/AwContents.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java
index 2e26dc19e70fc186c39304658af538ce0b8224ef..13326792ff3b8bc9c673f6f4854698b0caf3b303 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -315,9 +315,13 @@ public class AwContents implements SmartClipProvider,
private static final class DestroyRunnable implements Runnable {
private final long mNativeAwContents;
+ // Hold onto a reference to the window (via its wrapper), so that it is not destroyed
+ // until we are done here.
+ private final WindowAndroidWrapper mWindowAndroid;
- private DestroyRunnable(long nativeAwContents) {
+ private DestroyRunnable(long nativeAwContents, WindowAndroidWrapper windowAndroid) {
mNativeAwContents = nativeAwContents;
+ mWindowAndroid = windowAndroid;
}
@Override
public void run() {
@@ -975,7 +979,7 @@ public class AwContents implements SmartClipProvider,
// The native side object has been bound to this java instance, so now is the time to
// bind all the native->java relationships.
mCleanupReference =
- new CleanupReference(this, new DestroyRunnable(mNativeAwContents));
+ new CleanupReference(this, new DestroyRunnable(mNativeAwContents, mWindowAndroid));
}
private void installWebContentsObserver() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698