diff options
author | Lars Knoll <lars.knoll@digia.com> | 2014-10-31 10:40:14 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-10-31 15:42:17 +0100 |
commit | e67948823d6810c2de784859da52a261bf80b550 (patch) | |
tree | e824180f148fd3a52668ea705d4b9eb6b2f172ca | |
parent | 87755d0437413cfb875c50e3dfa53030601567c9 (diff) |
Don't allocate less memory than required
When switching from a simple to a sparse array,
keep the previously allocated size, to not corrupt
memory.
Change-Id: I33f0fb049a2ad6f24ee3703f2c333855830fe9d2
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
-rw-r--r-- | src/qml/jsruntime/qv4arraydata.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4arraydata.cpp b/src/qml/jsruntime/qv4arraydata.cpp index 3235a116ee..12254c6384 100644 --- a/src/qml/jsruntime/qv4arraydata.cpp +++ b/src/qml/jsruntime/qv4arraydata.cpp @@ -104,6 +104,8 @@ void ArrayData::realloc(Object *o, Type newType, uint requested, bool enforceAtt if (requested <= d->alloc() && newType == d->type() && hasAttrs == enforceAttributes) return; + if (alloc < d->alloc()) + alloc = d->alloc(); if (d->type() < Sparse) { offset = static_cast<SimpleArrayData *>(d)->d()->offset; |