diff --git a/CHANGELOG.md b/CHANGELOG.md index e5d7d1076..9e8537e8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -119,7 +119,7 @@ - Dev: Channels without any animated elements on screen will skip updates from the GIF timer. (#5042, #5043, #5045) - Dev: Autogenerate docs/plugin-meta.lua. (#5055) - Dev: Refactor `NetworkPrivate`. (#5063) -- Dev: Refactor `Paths` & `Updates`, focusing on reducing their singletoniability. (#5092) +- Dev: Refactor `Paths` & `Updates`, focusing on reducing their singletoniability. (#5092, #5102) - Dev: Removed duplicate scale in settings dialog. (#5069) - Dev: Fix `NotebookTab` emitting updates for every message. (#5068) - Dev: Added benchmark for parsing and building recent messages. (#5071) diff --git a/src/Application.cpp b/src/Application.cpp index 1890bcf4d..23cfec26f 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -305,26 +305,35 @@ int Application::run(QApplication &qtApp) IEmotes *Application::getEmotes() { + assertInGuiThread(); + return this->emotes; } IUserDataController *Application::getUserData() { + assertInGuiThread(); + return this->userData; } ISoundController *Application::getSound() { + assertInGuiThread(); + return this->sound; } ITwitchLiveController *Application::getTwitchLiveController() { + assertInGuiThread(); + return this->twitchLiveController; } TwitchBadges *Application::getTwitchBadges() { + assertInGuiThread(); assert(this->twitchBadges); return this->twitchBadges.get(); @@ -332,16 +341,22 @@ TwitchBadges *Application::getTwitchBadges() ITwitchIrcServer *Application::getTwitch() { + assertInGuiThread(); + return this->twitch; } PubSub *Application::getTwitchPubSub() { + assertInGuiThread(); + return this->twitchPubSub.get(); } Logging *Application::getChatLogger() { + assertInGuiThread(); + return this->logging.get(); } @@ -884,8 +899,6 @@ Application *getApp() { assert(Application::instance != nullptr); - assertInGuiThread(); - return Application::instance; } @@ -893,8 +906,6 @@ IApplication *getIApp() { assert(IApplication::instance != nullptr); - assertInGuiThread(); - return IApplication::instance; } diff --git a/src/Application.hpp b/src/Application.hpp index 2e0d46fc9..176441e8e 100644 --- a/src/Application.hpp +++ b/src/Application.hpp @@ -1,12 +1,14 @@ #pragma once #include "common/Singleton.hpp" +#include "debug/AssertInGuiThread.hpp" #include "singletons/NativeMessaging.hpp" #include #include #include +#include #include namespace chatterino { @@ -161,43 +163,63 @@ public: } Theme *getThemes() override { + assertInGuiThread(); + return this->themes; } Fonts *getFonts() override { + assertInGuiThread(); + return this->fonts; } IEmotes *getEmotes() override; AccountController *getAccounts() override { + assertInGuiThread(); + return this->accounts; } HotkeyController *getHotkeys() override { + assertInGuiThread(); + return this->hotkeys; } WindowManager *getWindows() override { + assertInGuiThread(); + return this->windows; } Toasts *getToasts() override { + assertInGuiThread(); + return this->toasts; } CrashHandler *getCrashHandler() override { + assertInGuiThread(); + return this->crashHandler; } CommandController *getCommands() override { + assertInGuiThread(); + return this->commands; } NotificationController *getNotifications() override { + assertInGuiThread(); + return this->notifications; } HighlightController *getHighlights() override { + assertInGuiThread(); + return this->highlights; } ITwitchIrcServer *getTwitch() override; @@ -205,14 +227,20 @@ public: Logging *getChatLogger() override; ChatterinoBadges *getChatterinoBadges() override { + assertInGuiThread(); + return this->chatterinoBadges; } FfzBadges *getFfzBadges() override { + assertInGuiThread(); + return this->ffzBadges; } SeventvBadges *getSeventvBadges() override { + assertInGuiThread(); + return this->seventvBadges; } IUserDataController *getUserData() override; @@ -221,14 +249,20 @@ public: TwitchBadges *getTwitchBadges() override; ImageUploader *getImageUploader() override { + assertInGuiThread(); + return this->imageUploader; } SeventvAPI *getSeventvAPI() override { + assertInGuiThread(); + return this->seventvAPI; } Updates &getUpdates() override { + assertInGuiThread(); + return this->updates; }