From d0eadec77b66e81b77336331f8232d2c6149c396 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Wed, 1 Apr 2020 23:36:19 +0800 Subject: [PATCH] fix(executor): close_uv when future ready --- napi/src/executor.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/napi/src/executor.rs b/napi/src/executor.rs index 728cbaa1..2146002e 100644 --- a/napi/src/executor.rs +++ b/napi/src/executor.rs @@ -96,12 +96,12 @@ unsafe extern "C" fn poll_future(handle: *mut sys::uv_async_t) { let mut task = Arc::from_raw(data_ptr); if let Some(mut_task) = Arc::get_mut(&mut task) { if mut_task.poll_future() { - Arc::into_raw(task); - } else { sys::uv_close( handle as *mut sys::uv_handle_t, Some(drop_handle_after_close), ); + } else { + Arc::into_raw(task); }; } else { Arc::into_raw(task);