Skip to content

Commit

Permalink
Fix decoration lifecycle issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyriar committed Mar 21, 2022
1 parent b39477d commit 43a014e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/common/services/DecorationService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ export class DecorationService extends Disposable implements IDecorationService
if (decoration) {
decoration.onDispose(() => {
if (decoration) {
this._decorations.splice(this._decorations.indexOf(decoration), 1);
const index = this._decorations.indexOf(decoration);
if (index >= 0) {
this._decorations.splice(this._decorations.indexOf(decoration), 1);
}
}
});
this._decorations.push(decoration);
Expand Down Expand Up @@ -70,6 +73,10 @@ class Decoration extends Disposable implements IInternalDecoration {
}
}
public override dispose(): void {
if (this._isDisposed) {
return;
}
this._isDisposed = true;
this._onDispose.fire();
super.dispose();
}
Expand Down

0 comments on commit 43a014e

Please sign in to comment.