Skip to content

Commit 332508f

Browse files
Merge pull request #567 from lightpanda-io/kind_before_deinit
access the executor kind before it becomes invalid
2 parents 18a4960 + 158d11e commit 332508f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/runtime/js.zig

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -389,18 +389,18 @@ pub fn Env(comptime S: type, comptime types: anytype) type {
389389
// `gc_hints` option is enabled, we'll use the `lowMemoryNotification`
390390
// call on the isolate to encourage v8 to free the context.
391391
pub fn stopExecutor(self: *Self, executor: *Executor) void {
392-
executor.deinit();
393-
self.executor_pool.destroy(executor);
394-
if (self.gc_hints) {
395-
self.isolate.lowMemoryNotification();
396-
}
397-
398392
if (comptime builtin.mode == .Debug) {
399393
if (executor.kind == .main) {
400394
std.debug.assert(self.has_executor == true);
401395
self.has_executor = false;
402396
}
403397
}
398+
399+
executor.deinit();
400+
self.executor_pool.destroy(executor);
401+
if (self.gc_hints) {
402+
self.isolate.lowMemoryNotification();
403+
}
404404
}
405405

406406
// Give it a Zig struct, get back a v8.FunctionTemplate.

0 commit comments

Comments
 (0)