Skip to content

Commit

Permalink
Fix issue with disposable after being disposed (#229980)
Browse files Browse the repository at this point in the history
dont add disposable after disposed
  • Loading branch information
benibenj authored Sep 27, 2024
1 parent f029ec3 commit 2b5ec43
Showing 1 changed file with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,19 @@ export class ChatAttachmentsContentPart extends Disposable {

if (file) {
widget.style.cursor = 'pointer';
this.attachedContextDisposables.add(dom.addDisposableListener(widget, dom.EventType.CLICK, async (e: MouseEvent) => {
dom.EventHelper.stop(e, true);
this.openerService.open(
file,
{
fromUserGesture: true,
editorOptions: {
selection: range
} as any
});
}));
if (!this.attachedContextDisposables.isDisposed) {
this.attachedContextDisposables.add(dom.addDisposableListener(widget, dom.EventType.CLICK, async (e: MouseEvent) => {
dom.EventHelper.stop(e, true);
this.openerService.open(
file,
{
fromUserGesture: true,
editorOptions: {
selection: range
} as any
});
}));
}
}

widget.ariaLabel = ariaLabel;
Expand Down

0 comments on commit 2b5ec43

Please sign in to comment.