Index: content/worker/websharedworker_stub.cc |
diff --git a/content/worker/websharedworker_stub.cc b/content/worker/websharedworker_stub.cc |
index a2471df4a04783b8213ad403983d47297ce583fa..2737f6c422786f1ac3e74526ec7b8f9f2e490e5a 100644 |
--- a/content/worker/websharedworker_stub.cc |
+++ b/content/worker/websharedworker_stub.cc |
@@ -102,11 +102,11 @@ void WebSharedWorkerStub::OnConnect(int sent_message_port_id, int routing_id) { |
} |
void WebSharedWorkerStub::OnTerminateWorkerContext() { |
- impl_->terminateWorkerContext(); |
- |
+ running_ = false; |
// Call the client to make sure context exits. |
EnsureWorkerContextTerminates(); |
- running_ = false; |
+ // This may call "delete this" via WorkerScriptLoadFailed and Shutdown. |
+ impl_->terminateWorkerContext(); |
} |
void WebSharedWorkerStub::WorkerScriptLoaded() { |