summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShimeng (Simon) Wang <swang@google.com>2011-01-13 17:28:02 -0800
committerShimeng (Simon) Wang <swang@google.com>2011-01-13 17:28:02 -0800
commita7efc89ca675fa953f8d203d66e5cfa584f27910 (patch)
tree8d294cfc06c7efa0966a9b7b9537001e77681136
parent69dbe9fcda26341f31379053f8123d7f611c0be1 (diff)
downloadexternal_chromium-a7efc89ca675fa953f8d203d66e5cfa584f27910.zip
external_chromium-a7efc89ca675fa953f8d203d66e5cfa584f27910.tar.gz
external_chromium-a7efc89ca675fa953f8d203d66e5cfa584f27910.tar.bz2
Use current thread's JNIEnv.
Use current thread's JNIEnv instead of stale one during c++ destruction phase. issue: 3351191 Change-Id: Iffde3de965974ecdfe6e0284ca2ab5af6f89c8aa
-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)