summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qlist.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index f93b60d4bb..80a8d1eec9 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -521,7 +521,9 @@ void QList<T>::reserve(qsizetype asize)
template <typename T>
inline void QList<T>::squeeze()
{
- if (d->needsDetach() || size() != capacity()) {
+ if (!d.isMutable())
+ return;
+ if (d->needsDetach() || size() < capacity()) {
// must allocate memory
DataPointer detached(Data::allocate(size(), d->detachFlags() & ~Data::CapacityReserved));
if (size()) {