Index: Source/web/WebKit.cpp |
diff --git a/Source/web/WebKit.cpp b/Source/web/WebKit.cpp |
index 34fbaeb5d5ba7b163fa35f54a3cbc5eb9d9f0530..a6d8754f039f03651bf6d9c7c4ae1cc86cba318e 100644 |
--- a/Source/web/WebKit.cpp |
+++ b/Source/web/WebKit.cpp |
@@ -208,6 +208,11 @@ void shutdown() |
v8::Isolate* isolate = V8PerIsolateData::mainThreadIsolate(); |
V8PerIsolateData::willBeDestroyed(isolate); |
+ // Make sure we stop WorkerThreads before the main thread's ThreadState |
+ // and later shutdown steps starts freeing up resources needed during |
+ // worker termination. |
+ WorkerThread::terminateAndWaitForAllWorkers(); |
+ |
// Detach the main thread before starting the shutdown sequence |
// so that the main thread won't get involved in a GC during the shutdown. |
ThreadState::detachMainThread(); |