summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2019-07-15 15:28:47 -0700
committerThiago Macieira <thiago.macieira@intel.com>2019-07-16 18:09:51 -0700
commit8abbbb4c482c32cd5342f5f8576cee8cbacc3737 (patch)
treec041b16154dd878cf5c6f0d80324edf4715503a8 /src
parenta837ec15fec100567730a7bedb06655ef891ac96 (diff)
Fix regression causing QVector::fill w/ same size to not detach
Caused by commit 01301b0b340df736dd1b0a54b3026e00b49c5ea3, which made vector.resize(vector.size()) not to detach, which was used by fill() and assumed that detaching happened. The test does not test the resize() behavior, only that fill() is not broken anymore. [ChangeLog][QtCore][QVector] Fixed a regression that caused fill() not to detach, corrupting shared copies. Fixes: QTBUG-77058 Change-Id: I6aed4df6a12e43c3ac8efffd15b1b527a8007bf3 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/tools/qvector.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h
index 988d5a9e1b..57cf6e51ce 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -416,7 +416,7 @@ template <typename T>
void QVector<T>::resize(int asize)
{
if (asize == d->size)
- return;
+ return detach();
if (asize > int(d->alloc) || !isDetached()) { // there is not enough space
QArrayData::AllocationOptions opt = asize > int(d->alloc) ? QArrayData::Grow : QArrayData::Default;
realloc(qMax(int(d->alloc), asize), opt);