From 7ffa8ec7562af7b7a7f26132bda5a7bcf3c6adfa Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 12 Jan 2019 21:26:12 +0100 Subject: [PATCH] src: reset `StopTracingAgent()` before platform teardown This makes sure that `StopTracingAgent()` is always called before tearing down the `tracing::Agent`, since previously its destructor might have tried to access the agent, which would be destroyed by the (earlier) `Dispose()` call. PR-URL: https://github.com/nodejs/node/pull/25472 Reviewed-By: Daniel Bevenius Reviewed-By: Minwoo Jung Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Anatoli Papirovski Reviewed-By: Joyee Cheung --- src/node.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/node.cc b/src/node.cc index 0f668472442273..b3e94f51cec29f 100644 --- a/src/node.cc +++ b/src/node.cc @@ -240,6 +240,7 @@ static struct { } void Dispose() { + StopTracingAgent(); platform_->Shutdown(); delete platform_; platform_ = nullptr; @@ -579,7 +580,6 @@ static void WaitForInspectorDisconnect(Environment* env) { void Exit(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); WaitForInspectorDisconnect(env); - v8_platform.StopTracingAgent(); int code = args[0]->Int32Value(env->context()).FromMaybe(0); env->Exit(code); } @@ -1468,7 +1468,6 @@ int Start(int argc, char** argv) { per_process::v8_initialized = true; const int exit_code = Start(uv_default_loop(), args, exec_args); - v8_platform.StopTracingAgent(); per_process::v8_initialized = false; V8::Dispose();