Skip to content

fail test at 'should invoke *all* callbacks from different weak references' #9

@Mingyiz

Description

@Mingyiz

Node version 10.8.0
platform windows 7 x64

when i run npm test, segment fault cause the mocha test failed.

the error happend at test/callback.js line 64

it('should invoke *all* callbacks from different weak references',
   function(done) {
  let obj = {};
  const r1 = weak(obj);
  const r2 = weak(obj);
  assert.strictEqual(weak.get(r1), obj);
  assert.strictEqual(weak.isDead(r1), false);
  obj = null;
  let called1 = false;
  let called2 = false;
  weak.addCallback(r1, function() {
    called1 = true
  });
  weak.addCallback(r2, function() {
    called2 = true
  });
  gc();
  setImmediate(() => {
    assert.strictEqual(weak.get(r1), undefined);   // <<-- Here segment fault
    assert.strictEqual(weak.isDead(r1), true);
    assert(called1);
    assert(called2);
    done();
  });
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions