Don't catch Rust panics in userdata finalizer on drop
This commit is contained in:
parent
1020315a9b
commit
1d7f105585
|
@ -450,11 +450,10 @@ pub unsafe fn init_userdata_metatable<T>(
|
|||
}
|
||||
|
||||
pub unsafe extern "C" fn userdata_destructor<T>(state: *mut ffi::lua_State) -> c_int {
|
||||
callback_error(state, |_| {
|
||||
check_stack(state, 1)?;
|
||||
// It's probably NOT a good idea to catch Rust panics in finalizer
|
||||
// Lua 5.4 ignores it, other versions generates `LUA_ERRGCMM` without calling message handler
|
||||
take_userdata::<T>(state);
|
||||
Ok(0)
|
||||
})
|
||||
0
|
||||
}
|
||||
|
||||
// In the context of a lua callback, this will call the given function and if the given function
|
||||
|
|
Loading…
Reference in New Issue