Skip to content

Commit

Permalink
src: reset StopTracingAgent() before platform teardown
Browse files Browse the repository at this point in the history
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: #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>
  • Loading branch information
addaleax committed Jan 23, 2019
1 parent 6347940 commit 7ffa8ec
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ static struct {
}

void Dispose() {
StopTracingAgent();
platform_->Shutdown();
delete platform_;
platform_ = nullptr;
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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();

Expand Down

0 comments on commit 7ffa8ec

Please sign in to comment.