mirror of
https://github.com/bdwgc/bdwgc-rust.git
synced 2026-05-30 02:18:57 -06:00
Fix
This commit is contained in:
12
src/lib.rs
12
src/lib.rs
@@ -84,12 +84,12 @@ impl Allocator {
|
|||||||
unsafe { GC_gcollect() }
|
unsafe { GC_gcollect() }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn register_finalizer(
|
pub unsafe fn register_finalizer(ptr: *const c_void, finalizer: impl FnOnce(*mut c_void)) {
|
||||||
ptr: *const c_void,
|
unsafe extern "C" fn finalize<F: FnOnce(*mut c_void)>(ptr: *mut c_void, data: *mut c_void) {
|
||||||
finalizer: extern "C" fn(*mut c_void, *mut c_void),
|
(*(data as *mut F))(ptr)
|
||||||
client_data: *const c_void,
|
}
|
||||||
) {
|
|
||||||
GC_register_finalizer(ptr, finalizer, client_data, null(), null());
|
GC_register_finalizer(ptr, finalize::<F>, &mut finalizer, null(), null());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user