summaryrefslogtreecommitdiffstats
path: root/WebKit/android/jni/WebSettings.cpp
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-10-27 15:47:41 +0100
committerSteve Block <steveblock@google.com>2010-10-28 11:12:43 +0100
commitbf3f67c4fcfd68df256e5c001c67969997a63e28 (patch)
treee78cada468d14c9cd244f2f565b90918b7e0bc57 /WebKit/android/jni/WebSettings.cpp
parente59ed3e2c930c8eeed844aa0365e8285d956a8f2 (diff)
downloadexternal_webkit-bf3f67c4fcfd68df256e5c001c67969997a63e28.zip
external_webkit-bf3f67c4fcfd68df256e5c001c67969997a63e28.tar.gz
external_webkit-bf3f67c4fcfd68df256e5c001c67969997a63e28.tar.bz2
Make sure we delete local references to jclass objects
Change-Id: I1b398bd0a84ce366eb2e686e5f14335d7aa5ed31
Diffstat (limited to 'WebKit/android/jni/WebSettings.cpp')
-rw-r--r--WebKit/android/jni/WebSettings.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/WebKit/android/jni/WebSettings.cpp b/WebKit/android/jni/WebSettings.cpp
index 825476b..62594ff 100644
--- a/WebKit/android/jni/WebSettings.cpp
+++ b/WebKit/android/jni/WebSettings.cpp
@@ -140,6 +140,7 @@ struct FieldIds {
mAutoFillProfileZipCode = env->GetFieldID(autoFillProfileClass, "mZipCode", "Ljava/lang/String;");
mAutoFillProfileCountry = env->GetFieldID(autoFillProfileClass, "mCountry", "Ljava/lang/String;");
mAutoFillProfilePhoneNumber = env->GetFieldID(autoFillProfileClass, "mPhoneNumber", "Ljava/lang/String;");
+ env->DeleteLocalRef(autoFillProfileClass);
#endif
LOG_ASSERT(mLayoutAlgorithm, "Could not find field mLayoutAlgorithm");
@@ -181,13 +182,16 @@ struct FieldIds {
LOG_ASSERT(mUseDoubleTree, "Could not find field mUseDoubleTree");
LOG_ASSERT(mPageCacheCapacity, "Could not find field mPageCacheCapacity");
- jclass c = env->FindClass("java/lang/Enum");
- LOG_ASSERT(c, "Could not find Enum class!");
- mOrdinal = env->GetMethodID(c, "ordinal", "()I");
+ jclass enumClass = env->FindClass("java/lang/Enum");
+ LOG_ASSERT(enumClass, "Could not find Enum class!");
+ mOrdinal = env->GetMethodID(enumClass, "ordinal", "()I");
LOG_ASSERT(mOrdinal, "Could not find method ordinal");
- c = env->FindClass("android/webkit/WebSettings$TextSize");
- LOG_ASSERT(c, "Could not find TextSize enum");
- mTextSizeValue = env->GetFieldID(c, "value", "I");
+ env->DeleteLocalRef(enumClass);
+
+ jclass textSizeClass = env->FindClass("android/webkit/WebSettings$TextSize");
+ LOG_ASSERT(textSizeClass, "Could not find TextSize enum");
+ mTextSizeValue = env->GetFieldID(textSizeClass, "value", "I");
+ env->DeleteLocalRef(textSizeClass);
}
// Field ids
@@ -534,6 +538,7 @@ int registerWebSettings(JNIEnv* env)
jclass clazz = env->FindClass("android/webkit/WebSettings");
LOG_ASSERT(clazz, "Unable to find class WebSettings!");
gFieldIds = new FieldIds(env, clazz);
+ env->DeleteLocalRef(clazz);
return jniRegisterNativeMethods(env, "android/webkit/WebSettings",
gWebSettingsMethods, NELEM(gWebSettingsMethods));
}