2010-01-13 Fumitoshi Ukai <ukai@chromium.org>
[WebKit-https.git] / WebCore / websockets / WorkerThreadableWebSocketChannel.cpp
index 6f45b53..de2906e 100644 (file)
@@ -330,6 +330,7 @@ void WorkerThreadableWebSocketChannel::Bridge::disconnect()
         m_peer = 0;
         m_loaderProxy.postTaskToLoader(createCallbackTask(&mainThreadDestroy, peer));
     }
+    m_workerContext = 0;
 }
 
 void WorkerThreadableWebSocketChannel::Bridge::clearClientWrapper()
@@ -345,6 +346,8 @@ void WorkerThreadableWebSocketChannel::Bridge::setMethodNotCompleted()
 
 void WorkerThreadableWebSocketChannel::Bridge::waitForMethodCompletion()
 {
+    if (!m_workerContext)
+        return;
     WorkerRunLoop& runLoop = m_workerContext->thread()->runLoop();
     MessageQueueWaitResult result = MessageQueueMessageReceived;
     ThreadableWebSocketChannelClientWrapper* clientWrapper = static_cast<ThreadableWebSocketChannelClientWrapper*>(m_workerClientWrapper.get());