From 158d11e93ca0a59861e433f94c946b8b5114fb95 Mon Sep 17 00:00:00 2001 From: Karl Seguin Date: Thu, 24 Apr 2025 16:36:04 +0800 Subject: [PATCH] access the executor kind before it becomes invalid --- src/runtime/js.zig | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/runtime/js.zig b/src/runtime/js.zig index fab5f246..e1a577c6 100644 --- a/src/runtime/js.zig +++ b/src/runtime/js.zig @@ -389,18 +389,18 @@ pub fn Env(comptime S: type, comptime types: anytype) type { // `gc_hints` option is enabled, we'll use the `lowMemoryNotification` // call on the isolate to encourage v8 to free the context. pub fn stopExecutor(self: *Self, executor: *Executor) void { - executor.deinit(); - self.executor_pool.destroy(executor); - if (self.gc_hints) { - self.isolate.lowMemoryNotification(); - } - if (comptime builtin.mode == .Debug) { if (executor.kind == .main) { std.debug.assert(self.has_executor == true); self.has_executor = false; } } + + executor.deinit(); + self.executor_pool.destroy(executor); + if (self.gc_hints) { + self.isolate.lowMemoryNotification(); + } } // Give it a Zig struct, get back a v8.FunctionTemplate.