chore: fix IsolateData handling (#20918)

This commit is contained in:
Shelley Vohr 2019-11-02 15:14:11 -07:00 committed by GitHub
parent 776cab96b1
commit b194d5d0e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 4 deletions

View file

@ -176,8 +176,12 @@ void AtomRendererClient::WillReleaseScriptContext(
// avoid memory leaks
auto* command_line = base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kNodeIntegrationInSubFrames) ||
command_line->HasSwitch(switches::kDisableElectronSiteInstanceOverrides))
command_line->HasSwitch(
switches::kDisableElectronSiteInstanceOverrides)) {
node::FreeEnvironment(env);
if (env == node_bindings_->uv_env())
node::FreeIsolateData(node_bindings_->isolate_data());
}
// ElectronBindings is tracking node environments.
electron_bindings_->EnvironmentDestroyed(env);