websocket: workaround of mSocketThread use-after-free when application is terminating

This commit is contained in:
roytam1 2023-12-27 19:17:25 +08:00
commit 3039da2cb2

View file

@ -2320,6 +2320,10 @@ WebSocketChannel::CleanupConnection()
{
LOG(("WebSocketChannel::CleanupConnection() %p", this));
if(!mSocketThread) { // freed elsewhere, give up here
return;
}
// This should run on the Socket Thread to prevent potential races.
bool onSocketThread;
nsresult rv = mSocketThread->IsOnCurrentThread(&onSocketThread);