Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
6.5
-
None
-
-
c7fc870aa (dev), eb9f0f1bc (6.6), cc95e11f8 (tqtc/lts-6.5)
Description
As summary; given a Q_INVOKABLE function that takes a std::vector<long> parameter, while the length of the passed vector is correct, its contents are zeroed. The attached test case includes the following such functions:
// All elements in the vector are zeroed: Q_INVOKABLE std::vector<size_t> f1(const std::vector<size_t>& v); Q_INVOKABLE std::vector<long> f2(const std::vector<long>& v); Q_INVOKABLE std::vector<unsigned long> f3(const std::vector<unsigned long>& v); // Works as expected: Q_INVOKABLE std::vector<int> f4(const std::vector<int>& v); Q_INVOKABLE long f5(long l);
Calling these functions like:
let a = [0, 1, 2, 3, 4]; console.log("js", a); console.log("f1", i.f1(a)); console.log("f2", i.f2(a)); console.log("f3", i.f3(a)); console.log("f4", i.f4(a)); console.log("f5", i.f5(42));
Results in this unexpected output:
qml: js [0,1,2,3,4] c++ std::vector(0, 0, 0, 0, 0) qml: f1 [0,0,0,0,0] c++ std::vector(0, 0, 0, 0, 0) qml: f2 [0,0,0,0,0] c++ std::vector(0, 0, 0, 0, 0) qml: f3 [0,0,0,0,0] c++ std::vector(0, 1, 2, 3, 4) qml: f4 [0,1,2,3,4] c++ 42 qml: f5 42
It works as expected in 6.4.2, so appears to be new to 6.5.x.