Skip to content

Commit

Permalink
[core] fix leaking DisposableCollection.onDispose event
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Kosyakov <[email protected]>
  • Loading branch information
akosyakov committed Apr 7, 2020
1 parent 710c17b commit 2bb5dd9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/core/src/common/disposable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,18 @@ export class DisposableCollection implements Disposable {
toDispose.forEach(d => this.push(d));
}

/**
* This event is fired only once
* on first dispose of not empty collection.
*/
get onDispose(): Event<void> {
return this.onDisposeEmitter.event;
}

protected checkDisposed(): void {
if (this.disposed && !this.disposingElements) {
this.onDisposeEmitter.fire(undefined);
this.onDisposeEmitter.dispose();
}
}

Expand Down

0 comments on commit 2bb5dd9

Please sign in to comment.