Merge pull request #502 from napi-rs/fix-adjust-external-memory-issue

fix(napi): napi_adjust_external_memory issue on wini686
This commit is contained in:
LongYinan 2021-03-12 16:22:10 +08:00 committed by GitHub
commit 526b335df3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1163,7 +1163,8 @@ unsafe extern "C" fn raw_finalize<T>(
if !finalize_hint.is_null() {
let size_hint = *Box::from_raw(finalize_hint as *mut Option<i64>);
if let Some(changed) = size_hint {
let status = sys::napi_adjust_external_memory(env, -changed, ptr::null_mut());
let mut adjusted = 0i64;
let status = sys::napi_adjust_external_memory(env, -changed, &mut adjusted);
debug_assert!(
status == sys::Status::napi_ok,
"Calling napi_adjust_external_memory failed"