Skip to content

Commit 312c02d

Browse files
committed
src: isolate->Dispose() order consistency
PR-URL: #30181 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: David Carlier <devnexen@gmail.com>
1 parent d7452b7 commit 312c02d

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/node.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,11 @@ class NODE_EXTERN MultiIsolatePlatform : public v8::Platform {
273273
// This function may only be called once per `Isolate`.
274274
virtual void RegisterIsolate(v8::Isolate* isolate,
275275
struct uv_loop_s* loop) = 0;
276-
// This needs to be called right before calling `Isolate::Dispose()`.
276+
277277
// This function may only be called once per `Isolate`, and discard any
278278
// pending delayed tasks scheduled for that isolate.
279279
virtual void UnregisterIsolate(v8::Isolate* isolate) = 0;
280+
280281
// The platform should call the passed function once all state associated
281282
// with the given isolate has been cleaned up. This can, but does not have to,
282283
// happen asynchronously.

src/node_worker.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,9 @@ class WorkerThreadData {
155155
w_->platform_->AddIsolateFinishedCallback(isolate, [](void* data) {
156156
*static_cast<bool*>(data) = true;
157157
}, &platform_finished);
158-
w_->platform_->UnregisterIsolate(isolate);
159158

160159
isolate->Dispose();
160+
w_->platform_->UnregisterIsolate(isolate);
161161

162162
// Wait until the platform has cleaned up all relevant resources.
163163
while (!platform_finished)

0 commit comments

Comments
 (0)