From bd06ffc2c674ce41b374694ccdd4efa64f132267 Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Fri, 16 Feb 2018 23:20:37 +0000 Subject: [PATCH] [vm] Check for mis-matched thread type in OSThread TLS destructor. Change-Id: I1d878d4d31877749cf47ddd3ef973386592fd714 Reviewed-on: https://dart-review.googlesource.com/42104 Commit-Queue: Ryan Macnak Reviewed-by: Zach Anderson --- runtime/vm/os_thread.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/runtime/vm/os_thread.cc b/runtime/vm/os_thread.cc index bcc71158d60..e2ca88b8676 100644 --- a/runtime/vm/os_thread.cc +++ b/runtime/vm/os_thread.cc @@ -62,6 +62,12 @@ OSThread* OSThread::CreateOSThread() { } OSThread::~OSThread() { + if (!is_os_thread()) { + // If the embedder enters an isolate on this thread and does not exit the + // isolate, the thread local at thread_key_, which we are destructing here, + // will contain a dart::Thread instead of a dart::OSThread. + FATAL("Thread exited without calling Dart_ExitIsolate"); + } RemoveThreadFromList(this); delete log_; log_ = NULL;