mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-28 07:47:03 -05:00
sys: Explicitly delete views so destructors get called properly
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -172,11 +172,11 @@ namespace hex {
|
||||
|
||||
/* Views */
|
||||
|
||||
void ContentRegistry::Views::add(std::unique_ptr<View> &&view) {
|
||||
getEntries().emplace_back(std::move(view));
|
||||
void ContentRegistry::Views::add(View *view) {
|
||||
getEntries().emplace_back(view);
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<View>>& ContentRegistry::Views::getEntries() {
|
||||
std::vector<View*>& ContentRegistry::Views::getEntries() {
|
||||
return SharedData::views;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace hex {
|
||||
u32 SharedData::customEventsLastId;
|
||||
std::vector<ContentRegistry::CommandPaletteCommands::Entry> SharedData::commandPaletteCommands;
|
||||
std::map<std::string, ContentRegistry::PatternLanguageFunctions::Function> SharedData::patternLanguageFunctions;
|
||||
std::vector<std::unique_ptr<View>> SharedData::views;
|
||||
std::vector<View*> SharedData::views;
|
||||
std::vector<ContentRegistry::Tools::Entry> SharedData::toolsEntries;
|
||||
std::vector<ContentRegistry::DataInspector::Entry> SharedData::dataInspectorEntries;
|
||||
u32 SharedData::patternPaletteOffset;
|
||||
|
||||
Reference in New Issue
Block a user