GeezerVison is showing github.com — src: clean up agent loop when exiting through destructor · nodejs/node@00c33a5
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: src/node.cc +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -398,10 +398,10 @@ static struct { |
398 | 398 | } |
399 | 399 |
|
400 | 400 | void Dispose() { |
| 401 | + tracing_agent_.reset(nullptr); |
401 | 402 | platform_->Shutdown(); |
402 | 403 | delete platform_; |
403 | 404 | platform_ = nullptr; |
404 | | - tracing_agent_.reset(nullptr); |
405 | 405 | } |
406 | 406 |
|
407 | 407 | void DrainVMTasks(Isolate* isolate) { |
|
Collapse file
Copy file name to clipboardExpand all lines: src/tracing/agent.cc +6Lines changed: 6 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -59,6 +59,7 @@ Agent::Agent() { |
59 | 59 | Agent* agent = ContainerOf(&Agent::initialize_writer_async_, async); |
60 | 60 | agent->InitializeWritersOnThread(); |
61 | 61 | }), 0); |
| 62 | + uv_unref(reinterpret_cast<uv_handle_t*>(&initialize_writer_async_)); |
62 | 63 | } |
63 | 64 |
|
64 | 65 | void Agent::InitializeWritersOnThread() { |
@@ -72,6 +73,11 @@ void Agent::InitializeWritersOnThread() { |
72 | 73 | } |
73 | 74 |
|
74 | 75 | Agent::~Agent() { |
| 76 | + categories_.clear(); |
| 77 | + writers_.clear(); |
| 78 | + |
| 79 | + StopTracing(); |
| 80 | + |
75 | 81 | uv_close(reinterpret_cast<uv_handle_t*>(&initialize_writer_async_), nullptr); |
76 | 82 | uv_run(&tracing_loop_, UV_RUN_ONCE); |
77 | 83 | CheckedUvLoopClose(&tracing_loop_); |
|