diff --git a/shell/browser/electron_browser_main_parts.cc b/shell/browser/electron_browser_main_parts.cc index b2c0bcb590a8..15cbf89eca6b 100644 --- a/shell/browser/electron_browser_main_parts.cc +++ b/shell/browser/electron_browser_main_parts.cc @@ -602,6 +602,7 @@ void ElectronBrowserMainParts::PostMainMessageLoopRun() { node_env_->set_trace_sync_io(false); js_env_->DestroyMicrotasksRunner(); node::Stop(node_env_.get(), node::StopFlags::kDoNotTerminateIsolate); + node_bindings_->set_uv_env(nullptr); node_env_.reset(); auto default_context_key = ElectronBrowserContext::PartitionKey("", false); diff --git a/shell/browser/electron_browser_main_parts.h b/shell/browser/electron_browser_main_parts.h index 41d69716f156..fdcfb6c0629a 100644 --- a/shell/browser/electron_browser_main_parts.h +++ b/shell/browser/electron_browser_main_parts.h @@ -155,10 +155,10 @@ class ElectronBrowserMainParts : public content::BrowserMainParts { // Before then, we just exit() without any intermediate steps. std::optional exit_code_; - std::unique_ptr node_bindings_; + const std::unique_ptr node_bindings_; // depends-on: node_bindings_ - std::unique_ptr electron_bindings_; + const std::unique_ptr electron_bindings_; // depends-on: node_bindings_ std::unique_ptr js_env_;