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

Callbacks passed to Function::new should be UnwindSafe. #1391

Open
m-hilgendorf opened this issue Jan 29, 2024 · 0 comments
Open

Callbacks passed to Function::new should be UnwindSafe. #1391

m-hilgendorf opened this issue Jan 29, 2024 · 0 comments

Comments

@m-hilgendorf
Copy link

m-hilgendorf commented Jan 29, 2024

This applies to other APIs that take callbacks such like mentioned in #534. This can help avoid undefined behavior when a Rust function is called from C++ and panics.

If the trait bound is too high a burden as it's a breaking change, the API implementations should use catch_unwind or mark functions that take callbacks as arguments as unsafe (which they currently are). Otherwise it should be well documented that panicking will (hopefully) crash the process when unwinding fails, whereas a normal panic would only crash a thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant