From 932ebc4e7c2a67538a36e311c32e00d434de189e Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 29 Apr 2014 14:45:13 +0200 Subject: 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 Reviewed-by: Lars Knoll --- src/qml/jsruntime/qv4functionobject.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/qml/jsruntime/qv4functionobject.cpp') 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); -- cgit v1.2.3