mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-22 17:31:58 -05:00
Use Vector::remove() in a place I wished I had it earlier.
This commit is contained in:
parent
7777c8844b
commit
9a387d96da
1 changed files with 5 additions and 6 deletions
|
@ -43,13 +43,12 @@ void Object::addChild(Object& object)
|
||||||
|
|
||||||
void Object::removeChild(Object& object)
|
void Object::removeChild(Object& object)
|
||||||
{
|
{
|
||||||
// Oh geez, Vector needs a remove() huh...
|
for (unsigned i = 0; i < m_children.size(); ++i) {
|
||||||
Vector<Object*> newList;
|
if (m_children[i] == &object) {
|
||||||
for (auto* child : m_children) {
|
m_children.remove(i);
|
||||||
if (child != &object)
|
return;
|
||||||
newList.append(child);
|
}
|
||||||
}
|
}
|
||||||
m_children = std::move(newList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Object::onTimer(TimerEvent&)
|
void Object::onTimer(TimerEvent&)
|
||||||
|
|
Loading…
Reference in a new issue