Skip to content

Conversation

fengalin
Copy link
Contributor

@fengalin fengalin commented Nov 7, 2024

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: gtk-rs/gir#1614

@sdroege sdroege added the needs-backport PR needs backporting to the current stable branch label Nov 7, 2024
@sdroege sdroege merged commit 6da7aba into gtk-rs:main Nov 7, 2024
48 checks passed
@fengalin fengalin deleted the fix-callback-userdata-mutability branch November 7, 2024 08:50
@sdroege sdroege added backported PR was backported to the current stable branch and removed needs-backport PR needs backporting to the current stable branch labels Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backported PR was backported to the current stable branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants