access the executor kind before it becomes invalid

This commit is contained in:
Karl Seguin
2025-04-24 16:36:04 +08:00
parent 18a49601a0
commit 158d11e93c

View File

@@ -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.