aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-04-29 14:45:13 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-05-21 16:20:35 +0200
commit932ebc4e7c2a67538a36e311c32e00d434de189e (patch)
treee8ee350c2d79ebff80cb8cfdf941af690edbcd94 /src
parent358436f32a4e35091e8b56e32cf639b303665426 (diff)
Fix failing assertion inside MSVC STL in debug builds
When using FunctionObject's call() method, we use std::copy to copy the arguments over to the new call context. Unfortunately std::copy has an assertion in there to check that we're not copying out of bounds. What the STL doesn't know is that the Value args[1] array is dynamically allocated and easily expands beyond just one entry. Fall back to copying by hand to work around this issue. Task-number: QTBUG-38195 Change-Id: I6e254b1c893ccf5cad2358179cda1b07b00228e0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index 8e943fa6ef..39a123c4d2 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -326,8 +326,8 @@ ReturnedValue FunctionPrototype::method_call(CallContext *ctx)
ScopedCallData callData(scope, ctx->callData->argc ? ctx->callData->argc - 1 : 0);
if (ctx->callData->argc) {
- std::copy(ctx->callData->args + 1,
- ctx->callData->args + ctx->callData->argc, callData->args);
+ for (int i = 1; i < ctx->callData->argc; ++i)
+ callData->args[i - 1] = ctx->callData->args[i];
}
callData->thisObject = ctx->argument(0);
return o->call(callData);