summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShimeng (Simon) Wang <swang@google.com>2011-01-14 11:11:18 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-01-14 11:11:18 -0800
commitdac52a1b6f0c401bccca1e5713f782a8b26345b3 (patch)
tree0e1ebb5bb570cfea46845994c9fc108a0902c110
parenta01ff25d304217e7ef77ad2d83f48aca73be2c9d (diff)
parenta7efc89ca675fa953f8d203d66e5cfa584f27910 (diff)
downloadexternal_chromium-dac52a1b6f0c401bccca1e5713f782a8b26345b3.zip
external_chromium-dac52a1b6f0c401bccca1e5713f782a8b26345b3.tar.gz
external_chromium-dac52a1b6f0c401bccca1e5713f782a8b26345b3.tar.bz2
Merge "Use current thread's JNIEnv." into honeycomb
-rw-r--r--android/app/l10n_util.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/android/app/l10n_util.cc b/android/app/l10n_util.cc
index 2651c56..9ea87e8 100644
--- a/android/app/l10n_util.cc
+++ b/android/app/l10n_util.cc
@@ -52,8 +52,13 @@ JNIHelper::JNIHelper()
JNIHelper::~JNIHelper()
{
- if (mEnv)
- mEnv->DeleteGlobalRef(mClassRef);
+ if (mEnv) {
+ // Because the stored mEnv could be bad during c++ destruction phase
+ // since it's thread local.
+ JNIEnv* currentEnv = android::GetJNIEnv();
+ if (currentEnv)
+ currentEnv->DeleteGlobalRef(mClassRef);
+ }
}
string16 JNIHelper::getLocalisedString(int message_id)