Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ export class EditorPool extends Disposable {
object: codeBlock,
isStale: () => stale,
dispose: () => {
codeBlock.reset();
stale = true;
this._pool.release(codeBlock);
if (!stale) {
codeBlock.reset();
stale = true;
this._pool.release(codeBlock);
}
}
};
}
Expand Down Expand Up @@ -79,9 +81,11 @@ export class DiffEditorPool extends Disposable {
object: codeBlock,
isStale: () => stale,
dispose: () => {
codeBlock.reset();
stale = true;
this._pool.release(codeBlock);
if (!stale) {
codeBlock.reset();
stale = true;
this._pool.release(codeBlock);
}
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,12 +391,16 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
this.fileTreesByResponseId.clear();
this.focusedFileTreesByResponseId.clear();
this.responseTemplateDataByRequestId.clear();

// Fire first so that templates clear their rendered parts and release pool
// items back into the pool arrays, then clear the pools to dispose them.
// Clearing the pools before firing would leave released items undisposed.
this._onDidUpdateViewModel.fire();
this._editorPool.clear();
this._toolEditorPool.clear();
this._diffEditorPool.clear();
this._treePool.clear();
this._contentReferencesListPool.clear();
this._onDidUpdateViewModel.fire();
}

getCodeBlockInfoForEditor(uri: URI): IChatCodeBlockInfo | undefined {
Expand Down
Loading