Skip to content

Commit

Permalink
Fix callback name
Browse files Browse the repository at this point in the history
This should never have happened. I'll add a fix to seal our instance and test that.
  • Loading branch information
tronical committed Nov 28, 2023
1 parent f6cfd8d commit 6e8214e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions api/node/__test__/api.spec.mts
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,11 @@ test('callback closure cyclic references do not prevent GC', async (t) => {
let demo_module = loadFile(path.join(__dirname, "resources/test-gc.slint")) as any;
let demo = new demo_module.Test();
t.is(demo.check, "initial value");
t.true(Object.hasOwn(demo, "say_hello"));
let callback_invoked = false;
let demo_weak = new WeakRef(demo);

demo.my_callback = () => {
demo.say_hello = () => {
demo = null;
callback_invoked = true;
};
Expand All @@ -200,7 +201,7 @@ test('callback closure cyclic references do not prevent GC', async (t) => {
t.true(demo_weak.deref() !== undefined);

// Invoke the callback, to clear "demo"
demo.my_callback();
demo.say_hello();
t.true(callback_invoked);
t.true(demo === null);

Expand Down

0 comments on commit 6e8214e

Please sign in to comment.