From 335c9644191a8e0fc77722e7f702a6c47d03d058 Mon Sep 17 00:00:00 2001 From: WarmUpTill <19472752+WarmUpTill@users.noreply.github.com> Date: Fri, 4 Oct 2024 10:39:32 +0200 Subject: [PATCH] Fix connecting Twitch account leading to OBS freeze In rare cases the close() call for the Twitch chat connection might fail due to a race condition I have not fully figured out yet. As a workaround the connection to the chat server will be force closed for now. --- plugins/twitch/chat-connection.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/twitch/chat-connection.cpp b/plugins/twitch/chat-connection.cpp index e1f2c78e..978a047d 100644 --- a/plugins/twitch/chat-connection.cpp +++ b/plugins/twitch/chat-connection.cpp @@ -392,6 +392,11 @@ void TwitchChatConnection::Disconnect() if (ec) { blog(LOG_INFO, "TwitchChatConnection close failed: %s", ec.message().c_str()); + + // TODO: avoid using stop() + _stop = true; + std::this_thread::sleep_for(3s); + _client.stop(); } {