From 14f442be6cddaa648d9ed3bf91d9ef6147de8940 Mon Sep 17 00:00:00 2001
From: scatterflower <marisaposs@gameboyprinter.moe>
Date: Wed, 2 Sep 2020 09:29:40 -0500
Subject: [PATCH] fix race condition to delete websocket proxy object

---
 src/ws_client.cpp | 1 -
 src/ws_proxy.cpp  | 4 ----
 2 files changed, 5 deletions(-)

diff --git a/src/ws_client.cpp b/src/ws_client.cpp
index b6be2d9..2e39c4e 100644
--- a/src/ws_client.cpp
+++ b/src/ws_client.cpp
@@ -44,7 +44,6 @@ void WSClient::onTcpData()
 void WSClient::onWsDisconnect()
 {
     tcp_socket->disconnectFromHost();
-    tcp_socket->close();
 }
 
 void WSClient::onTcpDisconnect()
diff --git a/src/ws_proxy.cpp b/src/ws_proxy.cpp
index b1cd44a..92f8c92 100644
--- a/src/ws_proxy.cpp
+++ b/src/ws_proxy.cpp
@@ -47,10 +47,6 @@ void WSProxy::wsConnected()
     connect(new_tcp, &QTcpSocket::readyRead, client, &WSClient::onTcpData);
     connect(new_ws, &QWebSocket::disconnected, client, &WSClient::onWsDisconnect);
     connect(new_tcp, &QTcpSocket::disconnected, client, &WSClient::onTcpDisconnect);
-    connect(new_ws, &QWebSocket::disconnected, this, [=] {
-        clients.removeAll(client);
-        client->deleteLater();
-    });
     connect(new_tcp, &QTcpSocket::disconnected, this, [=] {
         clients.removeAll(client);
         client->deleteLater();