Index: net/cert/x509_util_android.cc |
diff --git a/net/cert/x509_util_android.cc b/net/cert/x509_util_android.cc |
index e3496b2db30ded757c7d798917eeec94e6095468..9648ffb91f09b39058059eca555d50c7f0298459 100644 |
--- a/net/cert/x509_util_android.cc |
+++ b/net/cert/x509_util_android.cc |
@@ -27,8 +27,12 @@ void RecordCertVerifyCapabilitiesHistogram(JNIEnv* env, |
} |
} |
-jobject GetApplicationContext(JNIEnv* env, jclass clazz) { |
- return base::android::GetApplicationContext(); |
+ScopedJavaLocalRef<jobject> GetApplicationContext(JNIEnv* env, jclass clazz) { |
+ ScopedJavaLocalRef<jobject> r; |
+ // Must use Reset to force creation of a new local ref, instead of trying to |
+ // adopt the global-ref'ed jobject as a local ref as the constructor would. |
+ r.Reset(env, base::android::GetApplicationContext()); |
+ return r; |
} |
bool RegisterX509Util(JNIEnv* env) { |