summaryrefslogtreecommitdiffstats
path: root/src/corelib/text/qstring.h
diff options
context:
space:
mode:
authorAndrei Golubev <andrei.golubev@qt.io>2020-09-02 11:39:13 +0200
committerAndrei Golubev <andrei.golubev@qt.io>2020-09-02 23:10:25 +0200
commit27fed69d0a5842a718e9afe1b82851e2803fc084 (patch)
treee4d83f50052710f3f059a7fe434e5aaaf9a8d79b /src/corelib/text/qstring.h
parentb98b7de0da395be33e2d1646ac62075422ce4343 (diff)
QString/QList: disregard space at front during reserve()
Aligned QString, QList to the new agreed upon behavior Aligned QList::resize() along the way to be consistent with QString/QBA Task-number: QTBUG-84320 Change-Id: Ie9d7b4b6ebe54bd373af78d92906144b383bbfe2 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/corelib/text/qstring.h')
-rw-r--r--src/corelib/text/qstring.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h
index 7daf86a366..d86d659e75 100644
--- a/src/corelib/text/qstring.h
+++ b/src/corelib/text/qstring.h
@@ -1167,7 +1167,7 @@ inline QString::~QString() {}
inline void QString::reserve(qsizetype asize)
{
- if (d->needsDetach() || asize >= capacity())
+ if (d->needsDetach() || asize >= capacity() - d.freeSpaceAtBegin())
reallocData(uint(qMax(asize, size())) + 1u, d->detachFlags());
// we're not shared anymore, for sure