Index: runtime/vm/object_store.cc |
diff --git a/runtime/vm/object_store.cc b/runtime/vm/object_store.cc |
index a0feb38bb8eea238f547e4fc1fe72a674e12dda4..91e3f1ae0be2c31cc30a24f4245e566fc83e4886 100644 |
--- a/runtime/vm/object_store.cc |
+++ b/runtime/vm/object_store.cc |
@@ -79,6 +79,7 @@ ObjectStore::ObjectStore() |
resume_capabilities_(GrowableObjectArray::null()), |
exit_listeners_(GrowableObjectArray::null()), |
error_listeners_(GrowableObjectArray::null()), |
+ sticky_error_(Error::null()), |
empty_context_(Context::null()), |
stack_overflow_(Instance::null()), |
out_of_memory_(Instance::null()), |
@@ -105,6 +106,17 @@ ObjectStore::~ObjectStore() { |
} |
+void ObjectStore::SetStickyErrorFromThread(const Thread* thread) { |
+ ASSERT(thread->IsMutatorThread()); |
+ if (thread->sticky_error() == Error::null()) { |
+ return; |
+ } |
+ // Protect overwriting valid error. |
+ ASSERT(sticky_error_ == Error::null()); |
+ sticky_error_ = thread->sticky_error(); |
+} |
+ |
+ |
void ObjectStore::VisitObjectPointers(ObjectPointerVisitor* visitor) { |
ASSERT(visitor != NULL); |
visitor->VisitPointers(from(), to()); |