summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormichaelbai@chromium.org <michaelbai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-13 19:01:03 +0000
committermichaelbai@chromium.org <michaelbai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-13 19:01:03 +0000
commit488b5a7c935a9a59556280fb934a1bb90bda5d6b (patch)
tree7cea977cde57bdf042bd881369b15bf93f526092
parentce83a41cd8f1b50d843927e7e8caa1127b955213 (diff)
downloadchromium_src-488b5a7c935a9a59556280fb934a1bb90bda5d6b.zip
chromium_src-488b5a7c935a9a59556280fb934a1bb90bda5d6b.tar.gz
chromium_src-488b5a7c935a9a59556280fb934a1bb90bda5d6b.tar.bz2
Check if java obj is valid before cancel permission request.
AwContents could be destoryed while the permission request is pending, In this case, Java object is already destoryed. BUG= Review URL: https://codereview.chromium.org/279313002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270159 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--android_webview/native/aw_contents.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/android_webview/native/aw_contents.cc b/android_webview/native/aw_contents.cc
index b9db7c1..6e9c1fe 100644
--- a/android_webview/native/aw_contents.cc
+++ b/android_webview/native/aw_contents.cc
@@ -550,10 +550,10 @@ void AwContents::OnPermissionRequest(AwPermissionRequest* request) {
void AwContents::OnPermissionRequestCanceled(AwPermissionRequest* request) {
JNIEnv* env = AttachCurrentThread();
ScopedJavaLocalRef<jobject> j_request = request->GetJavaObject();
- if (j_request.is_null())
+ ScopedJavaLocalRef<jobject> j_ref = java_ref_.get(env);
+ if (j_request.is_null() || j_ref.is_null())
return;
- ScopedJavaLocalRef<jobject> j_ref = java_ref_.get(env);
Java_AwContents_onPermissionRequestCanceled(
env, j_ref.obj(), j_request.obj());
}