@@ -785,9 +785,9 @@ static HMODULE (*get_module_handle_a_ptr)(_In_opt_ LPCSTR) = NULL; /* TODO: Impl
785785
786786#if 1 // NODE_MAJOR_VERSION < 18
787787 #if NODE_MAJOR_VERSION >= 12
788- #define node_loader_impl_register_module_id node::ModuleFlags::kLinked
788+ #define node_loader_impl_register_module_id node::ModuleFlags::kLinked | 0x08 /* NM_F_DELETEME */
789789 #else
790- #define node_loader_impl_register_module_id 0x02 /* NM_F_LINKED */
790+ #define node_loader_impl_register_module_id 0x02 | 0x08 /* NM_F_LINKED | NM_F_DELETEME */
791791 #endif
792792
793793 #define node_loader_impl_register_module (name, fn ) \
@@ -2271,7 +2271,6 @@ void node_loader_impl_func_await_safe(napi_env env, loader_impl_async_func_await
22712271
22722272void node_loader_impl_func_destroy_safe (napi_env env, loader_impl_async_func_destroy_safe_type *func_destroy_safe)
22732273{
2274- uint32_t ref_count = 0 ;
22752274 napi_handle_scope handle_scope;
22762275
22772276 /* Create scope */
@@ -2280,15 +2279,6 @@ void node_loader_impl_func_destroy_safe(napi_env env, loader_impl_async_func_des
22802279 node_loader_impl_exception (env, status);
22812280
22822281 /* Clear function persistent reference */
2283- status = napi_reference_unref (env, func_destroy_safe->node_func ->func_ref , &ref_count);
2284-
2285- node_loader_impl_exception (env, status);
2286-
2287- if (ref_count != 0 )
2288- {
2289- /* TODO: Error handling */
2290- }
2291-
22922282 status = napi_delete_reference (env, func_destroy_safe->node_func ->func_ref );
22932283
22942284 node_loader_impl_exception (env, status);
@@ -2398,7 +2388,6 @@ void node_loader_impl_future_await_safe(napi_env env, loader_impl_async_future_a
23982388
23992389void node_loader_impl_future_delete_safe (napi_env env, loader_impl_async_future_delete_safe_type *future_delete_safe)
24002390{
2401- uint32_t ref_count = 0 ;
24022391 napi_handle_scope handle_scope;
24032392
24042393 /* Create scope */
@@ -2407,15 +2396,6 @@ void node_loader_impl_future_delete_safe(napi_env env, loader_impl_async_future_
24072396 node_loader_impl_exception (env, status);
24082397
24092398 /* Clear promise reference */
2410- status = napi_reference_unref (env, future_delete_safe->node_future ->promise_ref , &ref_count);
2411-
2412- node_loader_impl_exception (env, status);
2413-
2414- if (ref_count != 0 )
2415- {
2416- /* TODO: Error handling */
2417- }
2418-
24192399 status = napi_delete_reference (env, future_delete_safe->node_future ->promise_ref );
24202400
24212401 node_loader_impl_exception (env, status);
@@ -2626,7 +2606,6 @@ void node_loader_impl_clear_safe(napi_env env, loader_impl_async_clear_safe_type
26262606 napi_value clear_str_value;
26272607 bool result = false ;
26282608 napi_handle_scope handle_scope;
2629- uint32_t ref_count = 0 ;
26302609
26312610 /* Create scope */
26322611 napi_status status = napi_open_handle_scope (env, &handle_scope);
@@ -2685,15 +2664,6 @@ void node_loader_impl_clear_safe(napi_env env, loader_impl_async_clear_safe_type
26852664 }
26862665
26872666 /* Clear handle persistent reference */
2688- status = napi_reference_unref (env, clear_safe->handle_ref , &ref_count);
2689-
2690- node_loader_impl_exception (env, status);
2691-
2692- if (ref_count != 0 )
2693- {
2694- /* TODO: Error handling */
2695- }
2696-
26972667 status = napi_delete_reference (env, clear_safe->handle_ref );
26982668
26992669 node_loader_impl_exception (env, status);
@@ -4486,7 +4456,6 @@ void node_loader_impl_walk(uv_handle_t *handle, void *arg)
44864456
44874457void node_loader_impl_destroy_safe_impl (loader_impl_node node_impl, napi_env env)
44884458{
4489- uint32_t ref_count = 0 ;
44904459 napi_status status;
44914460 napi_handle_scope handle_scope;
44924461
@@ -4514,28 +4483,10 @@ void node_loader_impl_destroy_safe_impl(loader_impl_node node_impl, napi_env env
45144483 }
45154484
45164485 /* Clear persistent references */
4517- status = napi_reference_unref (env, node_impl->global_ref , &ref_count);
4518-
4519- node_loader_impl_exception (env, status);
4520-
4521- if (ref_count != 0 )
4522- {
4523- /* TODO: Error handling */
4524- }
4525-
45264486 status = napi_delete_reference (env, node_impl->global_ref );
45274487
45284488 node_loader_impl_exception (env, status);
45294489
4530- status = napi_reference_unref (env, node_impl->function_table_object_ref , &ref_count);
4531-
4532- node_loader_impl_exception (env, status);
4533-
4534- if (ref_count != 0 )
4535- {
4536- /* TODO: Error handling */
4537- }
4538-
45394490 status = napi_delete_reference (env, node_impl->function_table_object_ref );
45404491
45414492 node_loader_impl_exception (env, status);
0 commit comments