From 6f6ccb8c2fefb0dd00d3bb125f68e51a3051bc14 Mon Sep 17 00:00:00 2001 From: pajlada Date: Sat, 8 May 2021 15:29:12 +0200 Subject: [PATCH] Fix a deadlock that would occur when loading Twitch badges (#2756) --- CHANGELOG.md | 1 + src/providers/twitch/TwitchBadges.cpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c3817acb..417589177 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - Minor: Messages held by automod are now shown to the user. (#2626) - Bugfix: Automod messages now work properly again. (#2682) - Bugfix: `Login expired` message no longer highlights all tabs. (#2735) +- Bugfix: Fix a deadlock that would occur during user badge loading. (#1704, #2756) ## 2.3.1 diff --git a/src/providers/twitch/TwitchBadges.cpp b/src/providers/twitch/TwitchBadges.cpp index f3455c71a..694c20270 100644 --- a/src/providers/twitch/TwitchBadges.cpp +++ b/src/providers/twitch/TwitchBadges.cpp @@ -88,6 +88,10 @@ void TwitchBadges::loaded() // Flush callback queue std::unique_lock queueLock(this->queueMutex_); + + // Once we have gained unique access of the queue, we can release our unique access of the loaded mutex allowing future calls to read locked_ + loadedLock.unlock(); + while (!this->callbackQueue_.empty()) { auto callback = this->callbackQueue_.front();