2010-01-13 Fumitoshi Ukai <ukai@chromium.org>
authorukai@chromium.org <ukai@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Jan 2010 02:23:08 +0000 (02:23 +0000)
committerukai@chromium.org <ukai@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Jan 2010 02:23:08 +0000 (02:23 +0000)
        Reviewed by David Levin.

        Fix websocket/tests/worker/worker-simple.html crash on Leopard Intel Debug (Tests) builder
        https://bugs.webkit.org/show_bug.cgi?id=33581

        unref m_workerContext when websocket is disconnected, so that avoid
        keeping reference to workerContext longer than worker thread runs.

        * websockets/WorkerThreadableWebSocketChannel.cpp:
        (WebCore::WorkerThreadableWebSocketChannel::Bridge::disconnect):
        (WebCore::WorkerThreadableWebSocketChannel::Bridge::waitForMethodCompletion):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@53226 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/websockets/WorkerThreadableWebSocketChannel.cpp

index 037556b..e2feca7 100644 (file)
@@ -1,3 +1,17 @@
+2010-01-13  Fumitoshi Ukai  <ukai@chromium.org>
+
+        Reviewed by David Levin.
+
+        Fix websocket/tests/worker/worker-simple.html crash on Leopard Intel Debug (Tests) builder
+        https://bugs.webkit.org/show_bug.cgi?id=33581
+
+        unref m_workerContext when websocket is disconnected, so that avoid
+        keeping reference to workerContext longer than worker thread runs.
+
+        * websockets/WorkerThreadableWebSocketChannel.cpp:
+        (WebCore::WorkerThreadableWebSocketChannel::Bridge::disconnect):
+        (WebCore::WorkerThreadableWebSocketChannel::Bridge::waitForMethodCompletion):
+
 2010-01-12  Jon Honeycutt  <jhoneycutt@apple.com>
 
         MSAA: selected, selectable, extended selectable, and multiple
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());