Chromium Code Reviews| Index: runtime/vm/thread_pool.cc |
| diff --git a/runtime/vm/thread_pool.cc b/runtime/vm/thread_pool.cc |
| index 86d2f609db871a78995d25f75e8118c1e8c53a0b..4b1fb24a63504f4bbd1d94ce6c6e00a3a1968a3b 100644 |
| --- a/runtime/vm/thread_pool.cc |
| +++ b/runtime/vm/thread_pool.cc |
| @@ -107,10 +107,18 @@ void ThreadPool::Shutdown() { |
| while (current != NULL) { |
| Worker* next = current->all_next_; |
| ThreadId currentId = current->id(); |
| - if (currentId != id) { |
| + if (currentId == OSThread::kInvalidThreadId) { |
| + // If the thread id is invalid, it means the thread never started |
| + // because OSThread creation was disabled. Destroy the Task and Worker. |
| + delete current->task_; |
| + delete current; |
| + current = NULL; |
| + } else if (currentId != id) { |
| AddWorkerToShutdownList(current); |
| } |
| - current->Shutdown(); |
| + if (current != NULL) { |
| + current->Shutdown(); |
|
siva
2015/12/30 20:51:02
Why is it necessary to call current->Shutdown() wh
zra
2015/12/30 22:36:28
Thinking about this more, it is not safe for a thr
|
| + } |
| current = next; |
| } |
| saved = NULL; |