Projects > cpp > Issues > Bug #4542

We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.

Create Issue on Github

websocket cash in win32

Bug #4542 [Closed] 2014-03-25 02:27 . Updated over 2 years ago

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
void deleteSelf();
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;
return 0;
} 2014-03-25 02:32

just wrap the codes of mutex in another function can solve. 2014-03-25 02:37
  • Status changed from New to Resolved
Anonymous 2014-03-25 08:35
  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100

Applied in changeset commit:2d98ab252b18139691146198038115cf79d17a91.

Atom PDF

Start date:2014-03-25
Due date:
% Done:


Target version:3.0-rc1

Sign up for our newsletter to keep up with the latest developments, releases and updates for Cocos2d-x.