summaryrefslogtreecommitdiff
path: root/Widgets
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2018-10-13 01:19:25 +0200
committerAndreas Kling <awesomekling@gmail.com>2018-10-13 01:19:25 +0200
commit9a387d96da2118709506d2df5c1beb148ed2ff9e (patch)
tree22e3d37dec0c10dd653be2fafc9608dd5f0806d6 /Widgets
parent7777c8844b07b49dbd077375a8d0dd696a758775 (diff)
downloadserenity-9a387d96da2118709506d2df5c1beb148ed2ff9e.zip
Use Vector::remove() in a place I wished I had it earlier.
Diffstat (limited to 'Widgets')
-rw-r--r--Widgets/Object.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/Widgets/Object.cpp b/Widgets/Object.cpp
index a46657a6d0..19c48ce1ef 100644
--- a/Widgets/Object.cpp
+++ b/Widgets/Object.cpp
@@ -43,13 +43,12 @@ void Object::addChild(Object& object)
void Object::removeChild(Object& object)
{
- // Oh geez, Vector needs a remove() huh...
- Vector<Object*> newList;
- for (auto* child : m_children) {
- if (child != &object)
- newList.append(child);
+ for (unsigned i = 0; i < m_children.size(); ++i) {
+ if (m_children[i] == &object) {
+ m_children.remove(i);
+ return;
+ }
}
- m_children = std::move(newList);
}
void Object::onTimer(TimerEvent&)