I’m trying to use set/get data on a widget. In one function I do:
let a_string: String = dataobj.uuid();
unsafe {
label.set_data("some_string", a_string);
}
In different function I use
let a_string = unsafe {
closest
.first_child()
.unwrap()
.first_child()
.unwrap()
.data::<String>("some_string")
.unwrap()
.read()
};
println!("aaaa {:?}", a_string);
It sometimes works, but sometimes a_string is some noise and println panics. I’d assume it’s pointer to a_string on the stack being saved via set_data, and therefore it crashes. But how else am I supposed to make it work? I haven’t found any examples in Rust.