summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qvector.h
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-05-07 22:53:24 +0200
committerOlivier Goffart <ogoffart@trolltech.com>2009-05-08 13:03:47 +0200
commitbf4d57a1477dbe800a53ccda3d8c4fe564b5092c (patch)
treefd0483e88c8700c68b8e62898e7129e3ce118d37 /src/corelib/tools/qvector.h
parent3e7fc907e5cc1937fb98bf4581cee960fe3d4e7a (diff)
Fix reentrancy of QVector and QString
The d->capacity could be modified even if ref was more than 1 Reviewed-by: Marius Storm-Olsen
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 3fd52ee1a1..1f047b8348 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -315,7 +315,7 @@ void QVector<T>::detach_helper()
{ realloc(d->size, d->alloc); }
template <typename T>
void QVector<T>::reserve(int asize)
-{ if (asize > d->alloc) realloc(d->size, asize); d->capacity = 1; }
+{ if (asize > d->alloc || d->ref != 1) realloc(d->size, asize); d->capacity = 1; }
template <typename T>
void QVector<T>::resize(int asize)
{ realloc(asize, (asize > d->alloc || (!d->capacity && asize < d->size && asize < (d->alloc >> 1))) ?