Skip to content

Commit 25519e5

Browse files
committed
Fix destructor in emcc.rs
1 parent 4f163af commit 25519e5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/libpanic_unwind/emcc.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,12 @@ cfg_if::cfg_if! {
8888
}
8989
extern "C" fn exception_cleanup(ptr: *mut libc::c_void) -> DestructorRet {
9090
unsafe {
91-
ptr::drop_in_place(ptr as *mut Exception);
92-
super::__rust_drop_panic();
91+
if let Some(b) = (ptr as *mut Exception).read().data {
92+
drop(b);
93+
super::__rust_drop_panic();
94+
}
95+
#[cfg(any(target_arch = "arm", target_arch = "wasm32"))]
96+
ptr
9397
}
9498
}
9599

0 commit comments

Comments
 (0)