From 85d6ff1e6c711c09c6904434a3d18c3d763f2305 Mon Sep 17 00:00:00 2001 From: pajlada Date: Sun, 16 Jun 2024 15:17:07 +0200 Subject: [PATCH] chore: unsingletonize Resources/Resources2 (#5460) --- CHANGELOG.md | 1 + cmake/resources/ResourcesAutogen.hpp.in | 5 ++--- src/singletons/Resources.cpp | 11 ++++++++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b43a3096..413142e04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ - Dev: Refactor `TwitchIrcServer`, making it abstracted. (#5421, #5435) - Dev: Reduced the amount of scale events. (#5404, #5406) - Dev: Removed unused timegate settings. (#5361) +- Dev: Unsingletonize `Resources2`. (#5460) - Dev: All Lua globals now show in the `c2` global in the LuaLS metadata. (#5385) - Dev: Images are now loaded in worker threads. (#5431) - Dev: Qt Creator now auto-configures Conan when loading the project and skips vcpkg. (#5305) diff --git a/cmake/resources/ResourcesAutogen.hpp.in b/cmake/resources/ResourcesAutogen.hpp.in index b047192d6..affafc3db 100644 --- a/cmake/resources/ResourcesAutogen.hpp.in +++ b/cmake/resources/ResourcesAutogen.hpp.in @@ -3,15 +3,14 @@ ** WARNING! All changes made in this file will be lost! *****************************************************************************/ #include -#include "common/Singleton.hpp" namespace chatterino { -class Resources2 : public Singleton +class Resources2 { public: Resources2(); @RES_HEADER_CONTENT@ }; -} // namespace chatterino \ No newline at end of file +} // namespace chatterino diff --git a/src/singletons/Resources.cpp b/src/singletons/Resources.cpp index 18995dc31..7bafdd4fb 100644 --- a/src/singletons/Resources.cpp +++ b/src/singletons/Resources.cpp @@ -2,10 +2,15 @@ #include "debug/AssertInGuiThread.hpp" -namespace chatterino { namespace { - static Resources2 *resources = nullptr; -} + +using namespace chatterino; + +static Resources2 *resources = nullptr; + +} // namespace + +namespace chatterino { Resources2 &getResources() {