QPodArrayOps: don't set the new size in eraseIf() until after copying

These are POD types, so there's nothing to be unwound in case of
exceptions (and the only one that could happen is the Q_CHECK_PTR).

Change-Id: I79e700614d034281bf55fffd178f91fe21685f03
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
bb10
Thiago Macieira 2023-10-19 10:21:45 -07:00
parent f6e7fdd4ad
commit 08a9fdddfd
1 changed files with 1 additions and 1 deletions

View File

@ -236,7 +236,7 @@ public:
if (it == end)
return result;
QPodArrayOps<T> other(this->size, this->size);
QPodArrayOps<T> other(this->size);
Q_CHECK_PTR(other.data());
auto dest = other.begin();
// std::uninitialized_copy will fallback to ::memcpy/memmove()