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

Unified Diff: android_webview/native/aw_contents.cc

Issue 594103002: [aw] Unregister delegates from AwContents.destroy() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments. Created 6 years, 3 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
Index: android_webview/native/aw_contents.cc
diff --git a/android_webview/native/aw_contents.cc b/android_webview/native/aw_contents.cc
index f90241875cf5bd240fdedcf313a363ae0943cbab..6be0974420ccb9773a0b7fb20eb3e304448e602d 100644
--- a/android_webview/native/aw_contents.cc
+++ b/android_webview/native/aw_contents.cc
@@ -300,6 +300,10 @@ void AwContents::Destroy(JNIEnv* env, jobject obj) {
AwContentsClientBridgeBase::Disassociate(web_contents_.get());
contents_client_bridge_.reset();
+ // Do not wait until the WebContents are deleted asynchronously to clear
+ // the delegate and stop sending callbacks.
+ web_contents_->SetDelegate(NULL);
+
// We do not delete AwContents immediately. Some applications try to delete
// Webview in ShouldOverrideUrlLoading callback, which is a sync IPC from
// Webkit.

Powered by Google App Engine
This is Rietveld 408576698