Remove (internal) borrow counter and use instead "locked" flag and strong reference counter

This commit is contained in:
Alex Orlenko
2025-02-14 14:41:37 +00:00
parent 5b0d811c5a
commit 69d3ddec29
4 changed files with 31 additions and 22 deletions
+1 -1
View File
@@ -36,7 +36,7 @@ pub(crate) fn is_sync<T>() -> bool {
pub(super) unsafe extern "C-unwind" fn userdata_destructor<T>(state: *mut ffi::lua_State) -> c_int {
let ud = get_userdata::<UserDataStorage<T>>(state, -1);
if !(*ud).is_borrowed() {
if (*ud).is_safe_to_destroy() {
take_userdata::<UserDataStorage<T>>(state);
ffi::lua_pushboolean(state, 1);
} else {