diff --git a/plugins/libimhex/include/hex/api/content_registry.hpp b/plugins/libimhex/include/hex/api/content_registry.hpp index 232683a22..68938b0e9 100644 --- a/plugins/libimhex/include/hex/api/content_registry.hpp +++ b/plugins/libimhex/include/hex/api/content_registry.hpp @@ -107,13 +107,13 @@ namespace hex { template T, typename ... Args> static void add(Args&& ... args) { - return add(std::make_unique(std::forward(args)...)); + return add(new T(std::forward(args)...)); } - static std::vector>& getEntries(); + static std::vector& getEntries(); private: - static void add(std::unique_ptr &&view); + static void add(View *view); }; diff --git a/plugins/libimhex/include/hex/helpers/shared_data.hpp b/plugins/libimhex/include/hex/helpers/shared_data.hpp index e73ef69c0..192f49ff4 100644 --- a/plugins/libimhex/include/hex/helpers/shared_data.hpp +++ b/plugins/libimhex/include/hex/helpers/shared_data.hpp @@ -56,7 +56,7 @@ namespace hex { static u32 customEventsLastId; static std::vector commandPaletteCommands; static std::map patternLanguageFunctions; - static std::vector> views; + static std::vector views; static std::vector toolsEntries; static std::vector dataInspectorEntries; static u32 patternPaletteOffset; diff --git a/plugins/libimhex/source/api/content_registry.cpp b/plugins/libimhex/source/api/content_registry.cpp index 2182bd146..f1b604252 100644 --- a/plugins/libimhex/source/api/content_registry.cpp +++ b/plugins/libimhex/source/api/content_registry.cpp @@ -172,11 +172,11 @@ namespace hex { /* Views */ - void ContentRegistry::Views::add(std::unique_ptr &&view) { - getEntries().emplace_back(std::move(view)); + void ContentRegistry::Views::add(View *view) { + getEntries().emplace_back(view); } - std::vector>& ContentRegistry::Views::getEntries() { + std::vector& ContentRegistry::Views::getEntries() { return SharedData::views; } diff --git a/plugins/libimhex/source/helpers/shared_data.cpp b/plugins/libimhex/source/helpers/shared_data.cpp index 898308319..649ad5e8f 100644 --- a/plugins/libimhex/source/helpers/shared_data.cpp +++ b/plugins/libimhex/source/helpers/shared_data.cpp @@ -11,7 +11,7 @@ namespace hex { u32 SharedData::customEventsLastId; std::vector SharedData::commandPaletteCommands; std::map SharedData::patternLanguageFunctions; - std::vector> SharedData::views; + std::vector SharedData::views; std::vector SharedData::toolsEntries; std::vector SharedData::dataInspectorEntries; u32 SharedData::patternPaletteOffset; diff --git a/source/window.cpp b/source/window.cpp index 289bfddfe..ceb79a4fb 100644 --- a/source/window.cpp +++ b/source/window.cpp @@ -162,6 +162,10 @@ namespace hex { this->deinitGLFW(); ContentRegistry::Settings::store(); + for (auto &view : SharedData::views) + delete view; + SharedData::views.clear(); + this->deinitPlugins(); EventManager::unsubscribe(Events::SettingsChanged, this);