summaryrefslogtreecommitdiff
path: root/Libraries/LibCore
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-07-16 20:44:21 +0200
committerAndreas Kling <kling@serenityos.org>2020-07-16 20:46:44 +0200
commit6d27915f4b8ee882cfc820f362c2ae6aa46f0aaa (patch)
tree60be135f34dcbf52de2ae4fc371248674fc504ea /Libraries/LibCore
parent869a3e2cf3d24d0bac88a4b7647664c9a87472f7 (diff)
downloadserenity-6d27915f4b8ee882cfc820f362c2ae6aa46f0aaa.zip
LibCore: Turns some heap-allocated events into stack-allocated ones
Diffstat (limited to 'Libraries/LibCore')
-rw-r--r--Libraries/LibCore/Object.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/Libraries/LibCore/Object.cpp b/Libraries/LibCore/Object.cpp
index 1321230317..0aaf415f83 100644
--- a/Libraries/LibCore/Object.cpp
+++ b/Libraries/LibCore/Object.cpp
@@ -89,7 +89,8 @@ void Object::add_child(Object& object)
ASSERT(!object.parent() || object.parent() == this);
object.m_parent = this;
m_children.append(object);
- event(*make<Core::ChildEvent>(Core::Event::ChildAdded, object));
+ Core::ChildEvent child_event(Core::Event::ChildAdded, object);
+ event(child_event);
}
void Object::insert_child_before(Object& new_child, Object& before_child)
@@ -98,7 +99,8 @@ void Object::insert_child_before(Object& new_child, Object& before_child)
ASSERT(!new_child.parent() || new_child.parent() == this);
new_child.m_parent = this;
m_children.insert_before_matching(new_child, [&](auto& existing_child) { return existing_child.ptr() == &before_child; });
- event(*make<Core::ChildEvent>(Core::Event::ChildAdded, new_child, &before_child));
+ Core::ChildEvent child_event(Core::Event::ChildAdded, new_child, &before_child);
+ event(child_event);
}
void Object::remove_child(Object& object)
@@ -109,7 +111,8 @@ void Object::remove_child(Object& object)
NonnullRefPtr<Object> protector = object;
object.m_parent = nullptr;
m_children.remove(i);
- event(*make<Core::ChildEvent>(Core::Event::ChildRemoved, object));
+ Core::ChildEvent child_event(Core::Event::ChildRemoved, object);
+ event(child_event);
return;
}
}