Hello, group. I'm not sure if my issue is connected with that one "
Value lost from Go to QML?", but I see that behavior in my code too.
For example, I have the following specification to be rendered in QML:
type PlaceSpec struct {
X, Y float64
Control *ControlPointSpec
}
And this object is referenced within another specification:
type ArcSpec struct {
Place *PlaceSpec
Index int
}
Since there is no way (as for now) to pass a slice of specs into QML, I have set up a simple JS-procedure to form a list, getting values from Go land using index:
var a = model.value(i)
arcs[i] = {
"place": a.place,
"index": a.index,
}
Exactly every 47-48 times reading arcs[i].place.control yields null and then pointer address changes.
I think that's because of Go's GC machinery, but the master Gustavo should know better indeed.
The fix I've used in my case is to explicitly assign that pointer to a var/field, as follows:
arcs[i] = {
"place": a.place, "control": a.place.control,
"index": a.index,
}
Since then I use that object as arcs[i].control, but arcs[i].place.control works perfectly well too, now.
I hope that info would help someone.
Cheers.