mirror of
https://github.com/Zelda64Recomp/Zelda64Recomp
synced 2026-05-25 23:35:35 -04:00
Take ownership of created pointers on Element class.
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user