forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Heed the comment to not use fields of a Reference after calling its finalize callback, because such a call may destroy the Reference. Fixes: nodejs#19673 PR-URL: nodejs#19718 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
- Loading branch information
Gabriel Schulhof
committed
Apr 16, 2018
1 parent
f4b0f7a
commit dc4c825
Showing
4 changed files
with
33 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
'use strict'; | ||
// Flags: --expose-gc | ||
|
||
const common = require('../../common'); | ||
const assert = require('assert'); | ||
const addon = require(`./build/${common.buildType}/binding`); | ||
|
||
const obj1 = addon.createObject(10); | ||
let obj1 = addon.createObject(10); | ||
const obj2 = addon.createObject(20); | ||
const result = addon.add(obj1, obj2); | ||
assert.strictEqual(result, 30); | ||
|
||
// Make sure the native destructor gets called. | ||
obj1 = null; | ||
global.gc(); | ||
assert.strictEqual(addon.finalizeCount(), 1); |