summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qarraydata/simplevector.h
diff options
context:
space:
mode:
authorAndrei Golubev <andrei.golubev@qt.io>2021-03-24 16:47:33 +0100
committerAndrei Golubev <andrei.golubev@qt.io>2021-04-26 17:07:07 +0200
commita0253f5f0249024580050e4ec22d50cb139ef8d9 (patch)
tree43a61a5f66f94ed3af4c8fbd06814c05c71c39ce /tests/auto/corelib/tools/qarraydata/simplevector.h
parent10b46e7f0faecc42a94cc2e25ad3edd08ae28083 (diff)
Resurrect data moves in QList
Use the data moves to readjust the free space in the QList, which ultimately fixes the out-of-memory issues caused by cases like: forever { list.prepend(list.back()); list.removeLast(); } Task-number: QTBUG-91801 Task-number: QTBUG-91360 Task-number: QTBUG-93019 Pick-to: dev 6.0 6.1 Change-Id: Iacff69cbf36b8b5b176bb2663df635ec972c875c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests/auto/corelib/tools/qarraydata/simplevector.h')
-rw-r--r--tests/auto/corelib/tools/qarraydata/simplevector.h17
1 files changed, 1 insertions, 16 deletions
diff --git a/tests/auto/corelib/tools/qarraydata/simplevector.h b/tests/auto/corelib/tools/qarraydata/simplevector.h
index 747af3d422..1fc5e9b8e1 100644
--- a/tests/auto/corelib/tools/qarraydata/simplevector.h
+++ b/tests/auto/corelib/tools/qarraydata/simplevector.h
@@ -209,22 +209,7 @@ public:
d->insert(0, first, last - first);
}
- void append(const_iterator first, const_iterator last)
- {
- if (first == last)
- return;
-
- auto requiredSize = qsizetype(last - first);
- if (d->needsDetach() || d.freeSpaceAtEnd() < requiredSize) {
- DataPointer oldData;
- d.reallocateAndGrow(QArrayData::GrowsAtEnd, requiredSize, &oldData);
-
- d->copyAppend(first, last);
- return;
- }
-
- d->copyAppend(first, last);
- }
+ void append(const_iterator first, const_iterator last) { d->growAppend(first, last); }
void insert(int position, const_iterator first, const_iterator last)
{