fix: Crash on exit

Fixes #854
This commit is contained in:
WerWolv 2023-01-05 09:29:16 +01:00
parent 7d9c86f584
commit ff9048fcf0
4 changed files with 13 additions and 1 deletions

@ -1 +1 @@
Subproject commit 59d8ceccb0b668e16a5d2b25c457514c9e8c1493 Subproject commit beec45afc942209cc34d30f99eac42b2bb04aa79

View File

@ -24,6 +24,8 @@ namespace hex::api {
static const std::string &getThemeImagePostfix(); static const std::string &getThemeImagePostfix();
static std::optional<ImColor> parseColorString(const std::string &colorString); static std::optional<ImColor> parseColorString(const std::string &colorString);
static void reset();
private: private:
ThemeManager() = default; ThemeManager() = default;

View File

@ -115,4 +115,11 @@ namespace hex::api {
return themeNames; return themeNames;
} }
void ThemeManager::reset() {
ThemeManager::s_themes.clear();
ThemeManager::s_styleHandlers.clear();
ThemeManager::s_themeHandlers.clear();
ThemeManager::s_imagePostfix.clear();
}
} }

View File

@ -6,6 +6,7 @@
#include <hex/api/content_registry.hpp> #include <hex/api/content_registry.hpp>
#include <hex/api/project_file_manager.hpp> #include <hex/api/project_file_manager.hpp>
#include <hex/api/theme_manager.hpp>
#include <hex/ui/view.hpp> #include <hex/ui/view.hpp>
#include <hex/helpers/net.hpp> #include <hex/helpers/net.hpp>
#include <hex/helpers/fs.hpp> #include <hex/helpers/fs.hpp>
@ -227,6 +228,8 @@ namespace hex::init {
ContentRegistry::FileHandler::getEntries().clear(); ContentRegistry::FileHandler::getEntries().clear();
ContentRegistry::Hashes::impl::getHashes().clear(); ContentRegistry::Hashes::impl::getHashes().clear();
api::ThemeManager::reset();
{ {
auto &visualizers = ContentRegistry::HexEditor::impl::getVisualizers(); auto &visualizers = ContentRegistry::HexEditor::impl::getVisualizers();
for (auto &[name, visualizer] : visualizers) for (auto &[name, visualizer] : visualizers)