Commit f883bed
node-api: allow napi_delete_reference in finalizers
`napi_delete_reference` must be called immediately for a
`napi_reference` returned from `napi_wrap` in the corresponding
finalizer, in order to clean up the `napi_reference` timely.
`napi_delete_reference` is safe to be invoked during GC.
PR-URL: #55620
Reviewed-By: Gabriel Schulhof <gabrielschulhof@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Vladimir Morozov <vmorozov@microsoft.com>1 parent 65bc8e8 commit f883bedCopy full SHA for f883bed
File tree
Expand file treeCollapse file tree
5 files changed
+71
-5
lines changedOpen diff view settings
Filter options
- src
- test/js-native-api/6_object_wrap
Expand file treeCollapse file tree
5 files changed
+71
-5
lines changedOpen diff view settings
Collapse file
+3-1Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
2769 | 2769 | |
2770 | 2770 | |
2771 | 2771 | |
| 2772 | + |
| 2773 | + |
2772 | 2774 | |
2773 | 2775 | |
2774 | 2776 | |
2775 | | - |
| 2777 | + |
2776 | 2778 | |
2777 | 2779 | |
2778 | 2780 | |
|
Collapse file
test/js-native-api/6_object_wrap/6_object_wrap.cc
Copy file name to clipboardExpand all lines: test/js-native-api/6_object_wrap/6_object_wrap.cc+34-3Lines changed: 34 additions & 3 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
3 | 3 | |
4 | 4 | |
5 | 5 | |
| 6 | + |
| 7 | + |
6 | 8 | |
7 | 9 | |
8 | 10 | |
9 | 11 | |
10 | 12 | |
11 | 13 | |
12 | 14 | |
13 | | - |
14 | | - |
| 15 | + |
| 16 | + |
| 17 | + |
15 | 18 | |
16 | 19 | |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
17 | 25 | |
18 | 26 | |
19 | 27 | |
| ||
154 | 162 | |
155 | 163 | |
156 | 164 | |
157 | | - |
| 165 | + |
158 | 166 | |
159 | 167 | |
160 | 168 | |
| ||
198 | 206 | |
199 | 207 | |
200 | 208 | |
| 209 | + |
| 210 | + |
| 211 | + |
| 212 | + |
| 213 | + |
| 214 | + |
| 215 | + |
| 216 | + |
| 217 | + |
| 218 | + |
| 219 | + |
| 220 | + |
| 221 | + |
| 222 | + |
| 223 | + |
| 224 | + |
| 225 | + |
| 226 | + |
201 | 227 | |
202 | 228 | |
| 229 | + |
| 230 | + |
| 231 | + |
| 232 | + |
203 | 233 | |
204 | 234 | |
205 | 235 | |
206 | 236 | |
207 | 237 | |
208 | 238 | |
209 | 239 | |
| 240 | + |
210 | 241 | |
211 | 242 | |
212 | 243 | |
|
Collapse file
test/js-native-api/6_object_wrap/binding.gyp
Copy file name to clipboardExpand all lines: test/js-native-api/6_object_wrap/binding.gyp+7Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
5 | 5 | |
6 | 6 | |
7 | 7 | |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
8 | 15 | |
9 | 16 | |
10 | 17 | |
Collapse file
test/js-native-api/6_object_wrap/myobject.h
Copy file name to clipboardExpand all lines: test/js-native-api/6_object_wrap/myobject.h+3-1Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
6 | 6 | |
7 | 7 | |
8 | 8 | |
9 | | - |
| 9 | + |
| 10 | + |
| 11 | + |
10 | 12 | |
11 | 13 | |
12 | 14 | |
|
Collapse file
test/js-native-api/6_object_wrap/test-basic-finalizer.js
Copy file name to clipboard+24Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
0 commit comments