summaryrefslogtreecommitdiff
path: root/src/qml/jsruntime/qv4arraydata.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/jsruntime/qv4arraydata.cpp')
-rw-r--r--src/qml/jsruntime/qv4arraydata.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/qml/jsruntime/qv4arraydata.cpp b/src/qml/jsruntime/qv4arraydata.cpp
index 13a7bb281b..ed2122fb89 100644
--- a/src/qml/jsruntime/qv4arraydata.cpp
+++ b/src/qml/jsruntime/qv4arraydata.cpp
@@ -156,21 +156,22 @@ void ArrayData::realloc(Object *o, Type newType, uint offset, uint alloc, bool e
newData->sparse = old->sparse;
old->sparse = 0;
newData->freeList = old->freeList;
- return;
+ } else {
+ newData->sparse = new SparseArray;
+ uint *lastFree = &newData->freeList;
+ for (uint i = 0; i < toCopy; ++i) {
+ if (!newData->data[i].isEmpty()) {
+ SparseArrayNode *n = newData->sparse->insert(i);
+ n->value = i;
+ } else {
+ *lastFree = i;
+ newData->data[i].tag = Value::Empty_Type;
+ lastFree = &newData->data[i].uint_32;
+ }
+ }
}
- newData->sparse = new SparseArray;
uint *lastFree = &newData->freeList;
- for (uint i = 0; i < toCopy; ++i) {
- if (!newData->data[i].isEmpty()) {
- SparseArrayNode *n = newData->sparse->insert(i);
- n->value = i;
- } else {
- *lastFree = i;
- newData->data[i].tag = Value::Empty_Type;
- lastFree = &newData->data[i].uint_32;
- }
- }
for (uint i = toCopy; i < newData->alloc; ++i) {
*lastFree = i;
newData->data[i].tag = Value::Empty_Type;