-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Description
I know that panic unwinding from FFI is UB. But abort must terminate the program immediately, where can be problem here?
Let we have this code: https://github.com/janiorca/tinywin/blob/master/miniwin/src/main.rs
Try to add abort into WM_PAINT handler:
...
match msg {
winapi::um::winuser::WM_PAINT => {
println!("abort");
std::process::abort();
...
Try to run it (I use target i686_windows_gnu), and watch to console:
...
abort
abort
abort
abort
abort
abort
abort
abort
abort
abort
abort
abort
abort
...
Looks like abort called from WndProc doest not work.
In more complicated cases I cant write Winapi applications with "panic=abort" mode, because abort dont do what I want, and I need to write catch_unwind in std::panic, and generate unwinding boilerplate even in release mode and write std::process::exit(3) (which works correctly).
What's the problem with std::process::abort, and why in doesn't work from WndProc, but std::process:exit works good?