GeezerVison is showing github.com — n-api: unlink reference during its destructor · nodejs/node@88aa4e0
File tree
Expand file treeCollapse file tree
Open diff view settings
test/node-api/test_worker_terminate_finalization
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: src/js_native_api_v8.cc +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -220,6 +220,8 @@ class RefBase : protected Finalizer, RefTracker { |
220 | 220 | finalize_hint); |
221 | 221 | } |
222 | 222 |
|
| 223 | + virtual ~RefBase() { Unlink(); } |
| 224 | + |
223 | 225 | inline void* Data() { |
224 | 226 | return _finalize_data; |
225 | 227 | } |
@@ -240,7 +242,6 @@ class RefBase : protected Finalizer, RefTracker { |
240 | 242 | // the finalizer and _delete_self is set. In this case we |
241 | 243 | // know we need to do the deletion so just do it. |
242 | 244 | static inline void Delete(RefBase* reference) { |
243 | | - reference->Unlink(); |
244 | 245 | if ((reference->RefCount() != 0) || |
245 | 246 | (reference->_delete_self) || |
246 | 247 | (reference->_finalize_ran)) { |
|
Collapse file
Copy file name to clipboardExpand all lines: test/node-api/test_worker_terminate_finalization/test.js -2Lines changed: 0 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | 'use strict'; |
2 | 2 | const common = require('../../common'); |
3 | 3 |
|
4 | | -// TODO(addaleax): Run this test once it stops failing under ASAN/valgrind. |
5 | 4 | // Refs: https://github.com/nodejs/node/issues/34731 |
6 | 5 | // Refs: https://github.com/nodejs/node/pull/35777 |
7 | 6 | // Refs: https://github.com/nodejs/node/issues/35778 |
8 | | -common.skip('Reference management in N-API leaks memory'); |
9 | 7 |
|
10 | 8 | const { Worker, isMainThread } = require('worker_threads'); |
11 | 9 |
|
|