summaryrefslogtreecommitdiffstats
path: root/android/app/l10n_util.cc
diff options
context:
space:
mode:
Diffstat (limited to 'android/app/l10n_util.cc')
-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)