diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2010-03-10 18:31:54 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2010-03-11 09:16:43 (GMT) |
commit | fbb600a7a92b60b388406fecf2d8a94f0d4f5586 (patch) | |
tree | 1837ca921526b990b774e24a78213da9021e4d20 /src/corelib | |
parent | 7dc470fd96f50eff923208cdc6e273161062e2a7 (diff) | |
download | Qt-fbb600a7a92b60b388406fecf2d8a94f0d4f5586.zip Qt-fbb600a7a92b60b388406fecf2d8a94f0d4f5586.tar.gz Qt-fbb600a7a92b60b388406fecf2d8a94f0d4f5586.tar.bz2 |
QVarLenghtArray: Call constructor when resizing the array for Movable types.
The constructor of complex type that are declared as Movable (such
as many of our containers) were not being called.
The raison is that the 's' was set to 'asize' right after the qMemCopy
So we need to reset 's' to old size in the movable case (in all cases)
In the static case, 's' has already be incremented to osize
The 's = asize;' can be removed as it is anyway done at the very end of
the function
Task-number: QTBUG-6718
Reviewed-by: Harald Fernengel
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/tools/qvarlengtharray.h | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h index 1069b816..aecb66e 100644 --- a/src/corelib/tools/qvarlengtharray.h +++ b/src/corelib/tools/qvarlengtharray.h @@ -222,7 +222,6 @@ Q_OUTOFLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::realloc(int asize, int a } } else { qMemCopy(ptr, oldPtr, qMin(asize, osize) * sizeof(T)); - s = asize; } } else { ptr = oldPtr; @@ -233,7 +232,7 @@ Q_OUTOFLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::realloc(int asize, int a if (QTypeInfo<T>::isComplex) { while (osize > asize) (oldPtr+(--osize))->~T(); - if( oldPtr == ptr ) + if (!QTypeInfo<T>::isStatic) s = osize; } |