diff --git a/src/tracing/agent.cc b/src/tracing/agent.cc index 97a3e11a2c458c..ceab09e5a2789c 100644 --- a/src/tracing/agent.cc +++ b/src/tracing/agent.cc @@ -56,7 +56,9 @@ void Agent::Stop() { // Perform final Flush on TraceBuffer. We don't want the tracing controller // to flush the buffer again on destruction of the V8::Platform. tracing_controller_->StopTracing(); - delete tracing_controller_; + tracing_controller_->Initialize(nullptr); + tracing_controller_ = nullptr; + // Thread should finish when the tracing loop is stopped. uv_thread_join(&thread_); v8::platform::SetTracingController(platform_, nullptr);