We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.
websocket cash in win32
websocket cash in win32
Bug #4542 [Closed]
Status: | Closed | |
---|---|---|
Start date: | 2014-03-25 | |
Priority: | Normal | |
Due date: | ||
Assignee: | jingbin.chen@chukong-inc.com | |
% Done: | 100% |
|
Category: | windows | |
Target version: | 3.0-rc1 |
when receive message, use std::lock_guard in WsThreadHelper::update then call in onUIThreadReceiveMessage, will result to delete _wsHelper. While the mutex of _UIWsMessageQueueMutex is still lock, lead to crash. The crashed situation the same as following:
class TestA
{
public:
void deleteSelf();
protected:
private:
std::mutex m;
};
void TestA::deleteSelf()
{
std::lock_guardstd::mutex lk(m);
delete this; // while m is still lock, can not delete directly
}
int _tmain(int argc, _TCHAR* argv[])
{
TestA a;
a.deleteSelf();
return 0;
}