gtk-rs / gtk-rs-core

Rust bindings for GNOME libraries
https://gtk-rs.org/gtk-rs-core
MIT License
293 stars 115 forks source link

Fix callback userdata mutability #1566

Closed fengalin closed 2 weeks ago

fengalin commented 2 weeks ago

In some places, building userdata for FnMut callbacks consisted in taking an immutable reference to the user provided function, before converting it to a mutable pointer. This was UB and could lead to future optimizations considering a closure's captured context is immutable.

See also: https://github.com/gtk-rs/gir/pull/1614