Open piegamesde opened 4 years ago
I'm sorry if this is irrelevant and/or dumb, but would putting an Arc<Mutex<gdk_pixbuf::Pixbuf>>
in the message solve your problem?
It's neither nor. The problem with glib types is they are internally Rc<RefCell>
wrapped. They all have inner mutability and can be cloned and passed around freely. From a Rust perspective, this means that you have absolutely no control over the data in the inner and a Mutex
sadly won't change that.
How are messages handled internally? Why do they require
Send
andClone
?My concrete problem is that I have some images, stored as
gdk_pixbuf::Pixbuf
in the model. When clicking on a button, a new image is selected then loaded. So I thought I'd put the newPixbuf
into someAddImage
message. But I cannot do this because Message requiresSend
. Also since Message isClone
I'm starting to doubt if putting big data into it is a good idea at all.So, how should I go about this? How can I still communicated with and update my model?