From 2aee62382fc0507810f70dcf436ca18cf9683183 Mon Sep 17 00:00:00 2001 From: Kai Tamkun Date: Thu, 14 Nov 2024 17:57:52 -0800 Subject: [PATCH] Remove async cleanup hooks from the list after they're called, not before --- src/bun.js/bindings/napi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bun.js/bindings/napi.h b/src/bun.js/bindings/napi.h index 817b5d0eaf..86e2993b90 100644 --- a/src/bun.js/bindings/napi.h +++ b/src/bun.js/bindings/napi.h @@ -84,10 +84,10 @@ public: while (!m_asyncCleanupHooks.empty()) { auto [function, data, handle] = m_asyncCleanupHooks.back(); - m_asyncCleanupHooks.pop_back(); ASSERT(function != nullptr); function(handle, data); delete handle; + m_asyncCleanupHooks.pop_back(); } for (const BoundFinalizer& boundFinalizer : m_finalizers) {