Commit 7f56a78
Gabriel Schulhof
objectwrap: remove wrap only on failure
`napi_remove_wrap()` was intended for objects that are alive for which
the native addon wishes to withdraw its native pointer, and perhaps
replace it with another.
Therefore we need not `napi_remove_wrap()` during gc/env-cleanup. It is
sufficient to `napi_delete_reference()`, as `Reference<Object>`
already does. We need only `napi_remove_wrap()` if the construction
failed and therefore no gc callback will ever happen.
This change also removes references to `ObjectWrapConstructionContext`
from the header because the class is not used anymore.
Fixes: #660
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Kevin Eady <kevin.c.eady@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>1 parent 4d81618 commit 7f56a78
File tree
4 files changed
+33
-13
lines changed- test
4 files changed
+33
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3121 | 3121 | | |
3122 | 3122 | | |
3123 | 3123 | | |
3124 | | - | |
| 3124 | + | |
3125 | 3125 | | |
| 3126 | + | |
3126 | 3127 | | |
3127 | 3128 | | |
3128 | 3129 | | |
| |||
3694 | 3695 | | |
3695 | 3696 | | |
3696 | 3697 | | |
| 3698 | + | |
3697 | 3699 | | |
3698 | | - | |
| 3700 | + | |
3699 | 3701 | | |
3700 | | - | |
3701 | 3702 | | |
3702 | 3703 | | |
3703 | 3704 | | |
3704 | 3705 | | |
3705 | 3706 | | |
| 3707 | + | |
| 3708 | + | |
3706 | 3709 | | |
3707 | 3710 | | |
3708 | 3711 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
142 | 141 | | |
143 | 142 | | |
144 | 143 | | |
| |||
1403 | 1402 | | |
1404 | 1403 | | |
1405 | 1404 | | |
1406 | | - | |
1407 | 1405 | | |
1408 | 1406 | | |
1409 | 1407 | | |
| |||
1429 | 1427 | | |
1430 | 1428 | | |
1431 | 1429 | | |
1432 | | - | |
1433 | 1430 | | |
1434 | 1431 | | |
1435 | 1432 | | |
| |||
1888 | 1885 | | |
1889 | 1886 | | |
1890 | 1887 | | |
| 1888 | + | |
| 1889 | + | |
1891 | 1890 | | |
1892 | 1891 | | |
1893 | 1892 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
| |||
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
| 23 | + | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
25 | 28 | | |
26 | 29 | | |
27 | 30 | | |
| |||
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
33 | | - | |
| 36 | + | |
34 | 37 | | |
35 | 38 | | |
36 | 39 | | |
37 | | - | |
38 | 40 | | |
39 | 41 | | |
40 | 42 | | |
41 | | - | |
42 | 43 | | |
43 | | - | |
44 | 44 | | |
45 | 45 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
2 | 8 | | |
3 | 9 | | |
| 10 | + | |
4 | 11 | | |
5 | | - | |
| 12 | + | |
| 13 | + | |
6 | 14 | | |
7 | 15 | | |
8 | 16 | | |
| |||
12 | 20 | | |
13 | 21 | | |
14 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
15 | 32 | | |
16 | 33 | | |
17 | | - | |
| 34 | + | |
| 35 | + | |
0 commit comments