AK: Oops, the optimization in Vector::append(Vector&&) was broken.

It forgot to clear out the moved-from vector. It's easy to see where this bug
came from: I assumed m_impl was an OwnPtr. It would be comfy if move() on some
arbitrary T* would also null it out but alas that's not how things work.
This commit is contained in:
Andreas Kling 2019-02-11 12:44:01 +01:00
parent 298a49c688
commit fd5136a1ab
Notes: sideshowbarker 2024-07-19 15:47:28 +09:00

View File

@ -173,7 +173,8 @@ public:
void append(Vector<T>&& other)
{
if (!m_impl) {
m_impl = move(other.m_impl);
m_impl = other.m_impl;
other.m_impl = nullptr;
return;
}
Vector<T> tmp = move(other);