summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qvector.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2012-06-11 21:26:23 +0200
committerLars Knoll <lars.knoll@qt.io>2019-12-08 10:29:17 +0100
commit812a611dc05e5facd036856625ccb9274fdcb117 (patch)
tree06151f35165e3b2ae614d21be65e4555e19f45e7 /src/corelib/tools/qvector.h
parent62c673ccc6f81cee09a25f5acceec2768cea4672 (diff)
Stop using the reference counter to store data state
Instead of using the reference count to store whether the data is sharable and whether the header is immutable, move the settings to the flags member. This allows us to save one comparison per deref() or needsDetach(). It also allows for the possibility of mutable data pointed to by a static header. Change-Id: Ie678a2ff2bb9bce73497cb6138b431c465b0f3bb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/corelib/tools/qvector.h')
-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 d9512ee90e..bf422e72d4 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -701,7 +701,7 @@ void QVector<T>::removeLast()
Q_ASSERT(!isEmpty());
Q_ASSERT(d->allocatedCapacity());
- if (d->isShared())
+ if (d->needsDetach())
detach();
--d->size;
if (QTypeInfo<T>::isComplex)