Fix GC race condition in visit roots
While GC visits roots other code can change the set pending exception
due to lack of synchronization.
Change-Id: If387944ac933a66fe176df066c3a0ea52131cad4
Signed-off-by: Serguei Katkov <serguei.i.katkov@intel.com>
diff --git a/runtime/jni_internal.cc b/runtime/jni_internal.cc
index f1284db..9ca3c85 100644
--- a/runtime/jni_internal.cc
+++ b/runtime/jni_internal.cc
@@ -669,7 +669,8 @@
}
static void ExceptionClear(JNIEnv* env) {
- static_cast<JNIEnvExt*>(env)->self->ClearException();
+ ScopedObjectAccess soa(env);
+ soa.Self()->ClearException();
}
static void ExceptionDescribe(JNIEnv* env) {