Skip to content

Commit b113332

Browse files
backesaddaleax
authored andcommitted
src: ensure no more platform foreground tasks after Deinit
Node first calls `Isolate::Dispose`, then `NodePlatform::UnregisterIsolate`. This again calls `PerIsolatePlatformData::Shutdown`, which (before this patch) called `FlushForegroundTasksInternal`, which might call `RunForegroundTask` if it finds foreground tasks to be executed. This will fail however, since `Isolate::GetCurrent` was already reset during `Isolate::Dispose`. Hence remove the check to `FlushForegroundTasksInternal` and add checks instead that no more foreground tasks are scheduled. Refs: v8#86 PR-URL: #25653 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent 34bc69d commit b113332

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/node_platform.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,8 @@ void PerIsolatePlatformData::Shutdown() {
265265
if (flush_tasks_ == nullptr)
266266
return;
267267

268-
while (FlushForegroundTasksInternal()) {}
268+
CHECK_NULL(foreground_delayed_tasks_.Pop());
269+
CHECK_NULL(foreground_tasks_.Pop());
269270
CancelPendingDelayedTasks();
270271

271272
uv_close(reinterpret_cast<uv_handle_t*>(flush_tasks_),

0 commit comments

Comments
 (0)