diff options
Diffstat (limited to 'runtime/instrumentation.cc')
| -rw-r--r-- | runtime/instrumentation.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/runtime/instrumentation.cc b/runtime/instrumentation.cc index f11e2cba10..d862ff2708 100644 --- a/runtime/instrumentation.cc +++ b/runtime/instrumentation.cc @@ -1010,15 +1010,18 @@ void Instrumentation::FieldWriteEventImpl(Thread* thread, mirror::Object* this_o void Instrumentation::ExceptionCaughtEvent(Thread* thread, mirror::Throwable* exception_object) const { + Thread* self = Thread::Current(); + StackHandleScope<1> hs(self); + Handle<mirror::Throwable> h_exception(hs.NewHandle(exception_object)); if (HasExceptionCaughtListeners()) { - DCHECK_EQ(thread->GetException(), exception_object); + DCHECK_EQ(thread->GetException(), h_exception.Get()); thread->ClearException(); for (InstrumentationListener* listener : exception_caught_listeners_) { if (listener != nullptr) { - listener->ExceptionCaught(thread, exception_object); + listener->ExceptionCaught(thread, h_exception.Get()); } } - thread->SetException(exception_object); + thread->SetException(h_exception.Get()); } } |