src: call CleanupHandles in FreeEnvironment

CleanupHandles() has not been called in our own code base anymore
after the v8 debug agent has been removed. It used to be in the
~Environment() destructor but then removed to avoid firing other
events after the exit event, given that we were not going to
clean up handles for the one environment per process setup.
Call it in FreeEnvironment so that embedders can clean up
the handles in the loop when creating multiple environments.

PR-URL: https://github.com/nodejs/node/pull/19319
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jackson Tian <shyvo1987@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Joyee Cheung 2018-03-13 21:07:10 +08:00 committed by Anna Henningsen
parent c6ae8a2810
commit 855dabd675
No known key found for this signature in database
GPG Key ID: 9C63F3A6CD2AD8F9
2 changed files with 1 additions and 1 deletions

View File

@ -4405,6 +4405,7 @@ Environment* CreateEnvironment(IsolateData* isolate_data,
void FreeEnvironment(Environment* env) {
env->CleanupHandles();
delete env;
}

View File

@ -118,7 +118,6 @@ class EnvironmentTestFixture : public NodeTestFixture {
}
~Env() {
environment_->CleanupHandles();
node::FreeEnvironment(environment_);
node::FreeIsolateData(isolate_data_);
context_->Exit();