Skip to content

Commit 23383fa

Browse files
authored
Dispose the Throttler on ThrottledDelayer (microsoft#186767)
Fix microsoft#185689
1 parent 13c8667 commit 23383fa

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/vs/base/common/async.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,7 @@ export class ThrottledDelayer<T> {
417417

418418
dispose(): void {
419419
this.delayer.dispose();
420+
this.throttler.dispose();
420421
}
421422
}
422423

src/vs/base/test/common/async.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,12 @@ suite('Async', () => {
255255
// OK
256256
}
257257
});
258+
259+
test('trigger after dispose throws', async () => {
260+
const throttledDelayer = new async.ThrottledDelayer<void>(100);
261+
throttledDelayer.dispose();
262+
await assert.rejects(() => throttledDelayer.trigger(async () => { }, 0));
263+
});
258264
});
259265

260266
test('simple cancel', function () {

0 commit comments

Comments
 (0)