-
Notifications
You must be signed in to change notification settings - Fork 480
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 ub and shrink unsafe blocks #1435
base: master
Are you sure you want to change the base?
Conversation
// I tried using `std::panic::catch_unwind()` here and it compiled but | ||
// would not catch. Maybe wait for `c_unwind` to stabilize? Then the behavior | ||
// will automatically abort the process when panicking over an `extern "C"` | ||
// function. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know why that did not work, it should work.
Since Rust 1.81, unwinding in an extern "C"
function will abort the process, I added the catch_unwind
to not have this make undefined behavior on "older" (1.81 is almost 2 weeks old at the time of writing this comment) versions and have the same behavior independent of the Rust version.
between `FRect` and `sys::SDL_FRect`, and `FPoint` and`sys::SDL_FPoint`.
also shrink unsafe blocks
before this commit writing to the pointer returned by `FRect::raw_mut` was undefined behavior.
Breaking changes:
mixer::Chunk
fields were made private because the struct relied on these pointer being valid, but users could set them to any value'static
because the callback can be called after the scope ends (by usingstd::mem::forget
).timer ub reproduction (ran from a
#[test]
):