summaryrefslogtreecommitdiffstats
path: root/runtime/instrumentation.cc
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/instrumentation.cc')
-rw-r--r--runtime/instrumentation.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/runtime/instrumentation.cc b/runtime/instrumentation.cc
index dd73e66f11..2cd7f49a30 100644
--- a/runtime/instrumentation.cc
+++ b/runtime/instrumentation.cc
@@ -800,7 +800,10 @@ void Instrumentation::ExceptionCaughtEvent(Thread* thread, const ThrowLocation&
if (have_exception_caught_listeners_) {
DCHECK_EQ(thread->GetException(NULL), exception_object);
thread->ClearException();
- for (InstrumentationListener* listener : exception_caught_listeners_) {
+ // TODO: The copy below is due to the debug listener having an action where it can remove
+ // itself as a listener and break the iterator. The copy only works around the problem.
+ std::list<InstrumentationListener*> copy(exception_caught_listeners_);
+ for (InstrumentationListener* listener : copy) {
listener->ExceptionCaught(thread, throw_location, catch_method, catch_dex_pc, exception_object);
}
thread->SetException(throw_location, exception_object);