| Index: android_webview/native/aw_contents.cc
|
| diff --git a/android_webview/native/aw_contents.cc b/android_webview/native/aw_contents.cc
|
| index a8a81e9e9989f69d7d544986c6408a403e5d7f5b..b6b58f6a0cee3705ff0167db4cb702263c6df91d 100644
|
| --- a/android_webview/native/aw_contents.cc
|
| +++ b/android_webview/native/aw_contents.cc
|
| @@ -306,8 +306,11 @@ jint AwContents::GetWebContents(JNIEnv* env, jobject obj) {
|
| }
|
|
|
| void AwContents::Destroy(JNIEnv* env, jobject obj) {
|
| - delete this;
|
| -
|
| + java_ref_.reset();
|
| + // We do not delete AwContents immediately. Some applications try to delete
|
| + // Webview in ShouldOverrideUrlLoading callback, which is a sync IPC from
|
| + // Webkit.
|
| + BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, this);
|
| // When the last WebView is destroyed free all discardable memory allocated by
|
| // Chromium, because the app process may continue to run for a long time
|
| // without ever using another WebView.
|
|
|