fix: call UnregisterIsolate consistently (#28486)

This commit is contained in:
Fedor Indutny 2021-04-06 16:10:34 -07:00 committed by GitHub
parent 63317627b5
commit fe0da255b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View file

@ -279,10 +279,6 @@ int NodeMain(int argc, char* argv[]) {
node::Stop(env);
node::FreeEnvironment(env);
node::FreeIsolateData(isolate_data);
gin_env.platform()->DrainTasks(isolate);
gin_env.platform()->CancelPendingDelayedTasks(isolate);
gin_env.platform()->UnregisterIsolate(isolate);
}
// According to "src/gin/shell/gin_main.cc":

View file

@ -160,6 +160,9 @@ JavascriptEnvironment::JavascriptEnvironment(uv_loop_t* event_loop)
}
JavascriptEnvironment::~JavascriptEnvironment() {
DCHECK_NE(platform_, nullptr);
platform_->DrainTasks(isolate_);
{
v8::Locker locker(isolate_);
v8::HandleScope scope(isolate_);
@ -167,6 +170,9 @@ JavascriptEnvironment::~JavascriptEnvironment() {
}
isolate_->Exit();
g_isolate = nullptr;
platform_->CancelPendingDelayedTasks(isolate_);
platform_->UnregisterIsolate(isolate_);
}
class EnabledStateObserverImpl final