1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 09:07:44 +00:00

Everywhere: Stop using NonnullRefPtrVector

This class had slightly confusing semantics and the added weirdness
doesn't seem worth it just so we can say "." instead of "->" when
iterating over a vector of NNRPs.

This patch replaces NonnullRefPtrVector<T> with Vector<NNRP<T>>.
This commit is contained in:
Andreas Kling 2023-03-06 14:17:01 +01:00
parent 104be6c8ac
commit 8a48246ed1
168 changed files with 1280 additions and 1280 deletions

View file

@ -48,7 +48,7 @@ Object::~Object()
// NOTE: We also unparent the children, so that they won't try to unparent
// themselves in their own destructors.
for (auto& child : children)
child.m_parent = nullptr;
child->m_parent = nullptr;
all_objects().remove(*this);
stop_timer();
@ -103,7 +103,7 @@ void Object::insert_child_before(Object& new_child, Object& before_child)
void Object::remove_child(Object& object)
{
for (size_t i = 0; i < m_children.size(); ++i) {
if (m_children.ptr_at(i).ptr() == &object) {
if (m_children[i] == &object) {
// NOTE: We protect the child so it survives the handling of ChildRemoved.
NonnullRefPtr<Object> protector = object;
object.m_parent = nullptr;
@ -119,7 +119,7 @@ void Object::remove_child(Object& object)
void Object::remove_all_children()
{
while (!m_children.is_empty())
m_children.first().remove_from_parent();
m_children.first()->remove_from_parent();
}
void Object::timer_event(Core::TimerEvent&)