From a309d76d4c9f4e5564b09708004bf4b2e3401bb3 Mon Sep 17 00:00:00 2001 From: Serguei Katkov Date: Mon, 26 May 2014 11:23:39 +0700 Subject: 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 --- compiler/driver/compiler_driver_test.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'compiler/driver/compiler_driver_test.cc') diff --git a/compiler/driver/compiler_driver_test.cc b/compiler/driver/compiler_driver_test.cc index 964dfeb..ca956aa 100644 --- a/compiler/driver/compiler_driver_test.cc +++ b/compiler/driver/compiler_driver_test.cc @@ -173,7 +173,10 @@ TEST_F(CompilerDriverTest, AbstractMethodErrorStub) { env_->ExceptionClear(); jclass jlame = env_->FindClass("java/lang/AbstractMethodError"); EXPECT_TRUE(env_->IsInstanceOf(exception, jlame)); - Thread::Current()->ClearException(); + { + ScopedObjectAccess soa(Thread::Current()); + Thread::Current()->ClearException(); + } } // TODO: need check-cast test (when stub complete & we can throw/catch -- cgit v1.1