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 #1902

Merged
merged 3 commits into from
Nov 7, 2024

Conversation

fengalin
Copy link
Contributor

@fengalin fengalin commented Nov 6, 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

TODO:

  • update gir submodule & regenerate when matching PR is merged.

@fengalin fengalin force-pushed the fix-callback-userdata-mutability branch from 724aebe to 3973c0a Compare November 7, 2024 08:54
@fengalin fengalin changed the title Draft: Fix callback userdata mutability Fix callback userdata mutability Nov 7, 2024
@sdroege sdroege merged commit bd62288 into gtk-rs:main Nov 7, 2024
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants