mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 08:11:33 +11:00
Prevent a double panic
This commit is contained in:
parent
af170bdccf
commit
9fe526d0bc
|
@ -325,6 +325,14 @@ pub mod test_runner {
|
||||||
|
|
||||||
#[panic_handler]
|
#[panic_handler]
|
||||||
fn panic_implementation(info: &core::panic::PanicInfo) -> ! {
|
fn panic_implementation(info: &core::panic::PanicInfo) -> ! {
|
||||||
|
static IS_PANICKING: portable_atomic::AtomicBool = portable_atomic::AtomicBool::new(false);
|
||||||
|
if IS_PANICKING.load(portable_atomic::Ordering::SeqCst) {
|
||||||
|
// we panicked during the panic handler, so not much we can do here
|
||||||
|
loop {}
|
||||||
|
} else {
|
||||||
|
IS_PANICKING.store(true, portable_atomic::Ordering::SeqCst);
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "backtrace")]
|
#[cfg(feature = "backtrace")]
|
||||||
let frames = backtrace::unwind_exception();
|
let frames = backtrace::unwind_exception();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue