sys: Explicitly delete views so destructors get called properly

This commit is contained in:
WerWolv
2021-03-16 22:44:37 +01:00
parent b7dd936dae
commit ef747cc4c0
5 changed files with 12 additions and 8 deletions

View File

@@ -107,13 +107,13 @@ namespace hex {
template<hex::derived_from<View> T, typename ... Args>
static void add(Args&& ... args) {
return add(std::make_unique<T>(std::forward<Args>(args)...));
return add(new T(std::forward<Args>(args)...));
}
static std::vector<std::unique_ptr<View>>& getEntries();
static std::vector<View*>& getEntries();
private:
static void add(std::unique_ptr<View> &&view);
static void add(View *view);
};

View File

@@ -56,7 +56,7 @@ namespace hex {
static u32 customEventsLastId;
static std::vector<ContentRegistry::CommandPaletteCommands::Entry> commandPaletteCommands;
static std::map<std::string, ContentRegistry::PatternLanguageFunctions::Function> patternLanguageFunctions;
static std::vector<std::unique_ptr<View>> views;
static std::vector<View*> views;
static std::vector<ContentRegistry::Tools::Entry> toolsEntries;
static std::vector<ContentRegistry::DataInspector::Entry> dataInspectorEntries;
static u32 patternPaletteOffset;