Take ownership of created pointers on Element class.

This commit is contained in:
Dario
2025-01-12 22:48:32 -03:00
committed by Mr-Wiseguy
parent e037e1a8c6
commit 319788b5ba
9 changed files with 83 additions and 65 deletions
+12
View File
@@ -81,15 +81,27 @@ Element::Element(Element *parent, uint32_t events_enabled, Rml::String base_clas
base = parent->base->AppendChild(parent->base->GetOwnerDocument()->CreateElement(base_class));
if (parent->owner) {
parent->add_child(this);
}
register_event_listeners(events_enabled);
}
Element::~Element() {
children.clear();
if (owner) {
base->GetParentNode()->RemoveChild(base);
}
}
void Element::add_child(Element *child) {
assert(child != nullptr);
children.emplace_back(child);
}
void Element::set_property(Rml::PropertyId property_id, const Rml::Property &property, Animation animation) {
assert(base != nullptr);