Merge pull request #5466 from andyque/bug3868

closed #3868. when singleton deleted, it should not dispatch callbacks. This PR resolves: Possible crash on repeat running between HttpClientTest, WebSocketTest, SocketIOTest.
This commit is contained in:
James Chen 2014-02-26 11:56:33 +08:00
commit ffb815d5e6
1 changed files with 3 additions and 1 deletions

View File

@ -214,8 +214,10 @@ void HttpClient::networkThread()
s_responseQueue->pushBack(response); s_responseQueue->pushBack(response);
s_responseQueueMutex.unlock(); s_responseQueueMutex.unlock();
if (nullptr != s_pHttpClient) {
scheduler->performFunctionInCocosThread(CC_CALLBACK_0(HttpClient::dispatchResponseCallbacks, this)); scheduler->performFunctionInCocosThread(CC_CALLBACK_0(HttpClient::dispatchResponseCallbacks, this));
} }
}
// cleanup: if worker thread received quit signal, clean up un-completed request queue // cleanup: if worker thread received quit signal, clean up un-completed request queue
s_requestQueueMutex.lock(); s_requestQueueMutex.lock();