Skip to content

Commit 5e7cc23

Browse files
roblourensCopilot
andcommitted
fix: only register inputModel when we create it
Only dispose the input model when ChatInputPart created it. If someone else created the model (getModel returns an existing one), we should not take ownership of its lifecycle. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 447fa3f commit 5e7cc23

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2421,8 +2421,8 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
24212421
let inputModel = this.modelService.getModel(this.inputUri);
24222422
if (!inputModel) {
24232423
inputModel = this.modelService.createModel('', null, this.inputUri, true);
2424+
this._register(inputModel);
24242425
}
2425-
this._register(inputModel);
24262426

24272427
this.textModelResolverService.createModelReference(this.inputUri).then(ref => {
24282428
// make sure to hold a reference so that the model doesn't get disposed by the text model service

0 commit comments

Comments
 (0)