From 248cd46eb7cc3954b6cabed1769edf563ef24879 Mon Sep 17 00:00:00 2001 From: pajlada Date: Mon, 3 Jun 2024 10:31:30 +0200 Subject: [PATCH] fix: global emotes not loading (#5435) * fix: manually initialize twitchircserver after rest of singletons are initialized this fixes global emotes not being loaded on startup, since initialize was never called (since it was no longer added to the singleton list) * unrelated nit: remove copy/move ctors/operators of twitchircserver --- CHANGELOG.md | 2 +- src/Application.cpp | 2 ++ src/providers/twitch/TwitchIrcServer.cpp | 2 +- src/providers/twitch/TwitchIrcServer.hpp | 12 +++++++----- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a14c431c..1458dd484 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,7 +19,7 @@ - Dev: Add doxygen build target. (#5377) - Dev: Make printing of strings in tests easier. (#5379) - Dev: Refactor and document `Scrollbar`. (#5334, #5393) -- Dev: Refactor `TwitchIrcServer`, making it abstracted. (#5421) +- Dev: Refactor `TwitchIrcServer`, making it abstracted. (#5421, #5435) - Dev: Reduced the amount of scale events. (#5404, #5406) - Dev: Removed unused timegate settings. (#5361) - Dev: All Lua globals now show in the `c2` global in the LuaLS metadata. (#5385) diff --git a/src/Application.cpp b/src/Application.cpp index 5d70316bf..f9250f781 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -211,6 +211,8 @@ void Application::initialize(Settings &settings, const Paths &paths) singleton->initialize(settings, paths); } + this->twitch->initialize(); + // XXX: Loading Twitch badges after Helix has been initialized, which only happens after // the AccountController initialize has been called this->twitchBadges->loadTwitchBadges(); diff --git a/src/providers/twitch/TwitchIrcServer.cpp b/src/providers/twitch/TwitchIrcServer.cpp index e318d45af..7012cdb21 100644 --- a/src/providers/twitch/TwitchIrcServer.cpp +++ b/src/providers/twitch/TwitchIrcServer.cpp @@ -165,7 +165,7 @@ TwitchIrcServer::TwitchIrcServer() // false); } -void TwitchIrcServer::initialize(Settings &settings, const Paths &paths) +void TwitchIrcServer::initialize() { getIApp()->getAccounts()->twitch.currentUserChanged.connect([this]() { postToThread([this] { diff --git a/src/providers/twitch/TwitchIrcServer.hpp b/src/providers/twitch/TwitchIrcServer.hpp index 15e3af990..1f3dbe730 100644 --- a/src/providers/twitch/TwitchIrcServer.hpp +++ b/src/providers/twitch/TwitchIrcServer.hpp @@ -2,7 +2,6 @@ #include "common/Atomic.hpp" #include "common/Channel.hpp" -#include "common/Singleton.hpp" #include "providers/irc/AbstractIrcServer.hpp" #include @@ -52,15 +51,18 @@ public: // Update this interface with TwitchIrcServer methods as needed }; -class TwitchIrcServer final : public AbstractIrcServer, - public Singleton, - public ITwitchIrcServer +class TwitchIrcServer final : public AbstractIrcServer, public ITwitchIrcServer { public: TwitchIrcServer(); ~TwitchIrcServer() override = default; - void initialize(Settings &settings, const Paths &paths) override; + TwitchIrcServer(const TwitchIrcServer &) = delete; + TwitchIrcServer(TwitchIrcServer &&) = delete; + TwitchIrcServer &operator=(const TwitchIrcServer &) = delete; + TwitchIrcServer &operator=(TwitchIrcServer &&) = delete; + + void initialize(); void forEachChannelAndSpecialChannels( std::function func) override;