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 <daniel.bevenius@gmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This commit is contained in:
Anna Henningsen authored and Joyee Cheung committed 2019-01-16 22:58:04 +08:00
1 parent 391f839563
commit 84e90decd5
1 file changed
+1 -2
+1 -2
View File
@@ -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<Value>& args) {
Environment* env = Environment::GetCurrent(args);
WaitForInspectorDisconnect(env);
v8_platform.StopTracingAgent();
int code = args[0]->Int32Value(env->context()).FromMaybe(0);
env->Exit(code);
}
@@ -1477,7 +1477,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();