Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix callback userdata mutability #1566

Merged
merged 3 commits into from
Nov 7, 2024

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-backport PR needs backporting to the current stable branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants