From 07196503151c56e409d4fb02fb60690c1c5a9a5a Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 24 Jul 2017 14:56:56 +0900 Subject: [PATCH] Leak the Node environment when context is released --- atom/renderer/atom_renderer_client.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/atom/renderer/atom_renderer_client.cc b/atom/renderer/atom_renderer_client.cc index b03ec6c6fe85..6c8046c8acaf 100644 --- a/atom/renderer/atom_renderer_client.cc +++ b/atom/renderer/atom_renderer_client.cc @@ -132,7 +132,12 @@ void AtomRendererClient::WillReleaseScriptContext( node_bindings_->set_uv_env(nullptr); // Destroy the node environment. - node::FreeEnvironment(env); + // This is disabled because pending async tasks may still use the environment + // and would cause crashes later. Node does not seem to clear all async tasks + // when the environment is destroyed. + // node::FreeEnvironment(env); + + // AtomBindings is tracking node environments. atom_bindings_->EnvironmentDestroyed(env); }