mirror of https://github.com/axmolengine/axmol.git
Fixed WebSocket.cpp memory leaks (#17672)
This commit is contained in:
parent
97adaabefb
commit
4dac6b3f36
|
@ -362,6 +362,7 @@ void WsThreadHelper::onSubThreadLoop()
|
||||||
if (msg->what == WS_MSG_TO_SUBTHREAD_CREATE_CONNECTION)
|
if (msg->what == WS_MSG_TO_SUBTHREAD_CREATE_CONNECTION)
|
||||||
{
|
{
|
||||||
ws->onClientOpenConnectionRequest();
|
ws->onClientOpenConnectionRequest();
|
||||||
|
delete *iter;
|
||||||
iter = __wsHelper->_subThreadWsMessageQueue->erase(iter);
|
iter = __wsHelper->_subThreadWsMessageQueue->erase(iter);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -509,6 +510,7 @@ void WebSocket::closeAllConnections()
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lk(__instanceMutex);
|
std::lock_guard<std::mutex> lk(__instanceMutex);
|
||||||
__websocketInstances->clear();
|
__websocketInstances->clear();
|
||||||
|
delete __websocketInstances;
|
||||||
__websocketInstances = nullptr;
|
__websocketInstances = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue