From 19dbadefba19e711aa78fafc5ed39d71d37f2694 Mon Sep 17 00:00:00 2001 From: Louis Date: Mon, 15 Apr 2024 16:19:15 +0100 Subject: [PATCH] fix(ThreadsafeFunction): ensure CalleeHandled works as expected (#2039) This was refactored in 4719caa64377f7d926c92a4c1051474ae79036c4. This codepath was swapped, as the fatal exception must be the normal codepath when the callee handled field is false. This fixes it by swapping this if statement, all the other calls have been checked and seem fine. --- crates/napi/src/threadsafe_function.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/napi/src/threadsafe_function.rs b/crates/napi/src/threadsafe_function.rs index dfe2b05e..9c332b0d 100644 --- a/crates/napi/src/threadsafe_function.rs +++ b/crates/napi/src/threadsafe_function.rs @@ -658,7 +658,7 @@ unsafe extern "C" fn call_js_cb< ) }, Err(e) => { - if CalleeHandled { + if !CalleeHandled { unsafe { sys::napi_fatal_exception(raw_env, JsError::from(e).into_value(raw_env)) } } else { unsafe {