mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
Make views get auto deleted
This commit is contained in:
@@ -149,11 +149,11 @@ namespace hex {
|
||||
|
||||
/* Views */
|
||||
|
||||
View* ContentRegistry::Views::add(View *view) {
|
||||
return getEntries().emplace_back(view);
|
||||
void ContentRegistry::Views::add(std::unique_ptr<View> &&view) {
|
||||
getEntries().emplace_back(std::move(view));
|
||||
}
|
||||
|
||||
std::vector<View*>& ContentRegistry::Views::getEntries() {
|
||||
std::vector<std::unique_ptr<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<View*> SharedData::views;
|
||||
std::vector<std::unique_ptr<View>> SharedData::views;
|
||||
std::vector<ContentRegistry::Tools::Entry> SharedData::toolsEntries;
|
||||
std::vector<ContentRegistry::DataInspector::Entry> SharedData::dataInspectorEntries;
|
||||
u32 SharedData::patternPaletteOffset;
|
||||
|
||||
@@ -16,6 +16,10 @@ namespace hex {
|
||||
void View::drawMenu() { }
|
||||
bool View::handleShortcut(int key, int mods) { return false; }
|
||||
|
||||
bool View::isAvailable() {
|
||||
return SharedData::currentProvider != nullptr && SharedData::currentProvider->isAvailable();
|
||||
}
|
||||
|
||||
std::vector<std::function<void()>>& View::getDeferedCalls() {
|
||||
return SharedData::deferredCalls;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user