-
Bug
-
Resolution: Unresolved
-
P1: Critical
-
6.10.0
-
None
The following code fails if cachegen compiles the function bugTest():
Window {
id: window
visible: true
function foo(data: var) : void {
data.count = 1
}
function check(data : var) : void {
console.info("check", data.count === 1 ? "ok" : "fail")
}
function bugTest() : void {
const data = ({})
foo(data)
check(data)
// console.info(data.count) // uncomment to disable cachegen
}
Component.onCompleted: bugTest()
}
For some reason the object 'data' is cloned (CoW?) during the foo() function call. The expected behavior is that it is passed by reference.