Skip to content

Commit b21cfa9

Browse files
committed
doc: clarify ObjectWrap weak ref behavior (#1155)
Refs: nodejs/node#42461 We currently defer finalizer callbacks until the loop is idle. Warn users that the weak reference on ObjectWraps isn't guaranteed to be valid just because the object hasn't been finalized (destructed) yet.
1 parent ccbbe04 commit b21cfa9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

doc/object_wrap.md

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ be directly invoked from JavaScript. The **wrap** word refers to a way of
1616
grouping methods and state of the class because it will be necessary write
1717
custom code to bridge each of your C++ class methods.
1818

19+
**Caution:** When the JavaScript object is garbage collected, the call to the
20+
C++ destructor may be deferred until a later time. Within that period,
21+
`Value()` will return an empty value.
22+
1923
## Example
2024

2125
```cpp

0 commit comments

Comments
 (0)