mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-30 03:00:30 +01:00
Merge pull request #45317 from Microsoft/isidorn/listServiceDropDisposed
listService: forget about disposed lists
This commit is contained in:
@@ -97,6 +97,10 @@ export class PagedList<T> implements IDisposable {
|
||||
return this.list;
|
||||
}
|
||||
|
||||
get onDidDispose(): Event<void> {
|
||||
return this.list.onDidDispose;
|
||||
}
|
||||
|
||||
get onFocusChange(): Event<IListEvent<T>> {
|
||||
return mapEvent(this.list.onFocusChange, ({ elements, indexes }) => ({ elements: elements.map(e => this._model.get(e)), indexes }));
|
||||
}
|
||||
@@ -193,4 +197,4 @@ export class PagedList<T> implements IDisposable {
|
||||
dispose(): void {
|
||||
this.list.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1059,7 +1059,7 @@ export class List<T> implements ISpliceable<T>, IDisposable {
|
||||
}
|
||||
|
||||
isDOMFocused(): boolean {
|
||||
return this.view && this.view.domNode === document.activeElement;
|
||||
return this.view.domNode === document.activeElement;
|
||||
}
|
||||
|
||||
getHTMLElement(): HTMLElement {
|
||||
|
||||
@@ -131,7 +131,7 @@ export class Tree implements _.ITree {
|
||||
}
|
||||
|
||||
public isDOMFocused(): boolean {
|
||||
return this.view && this.view.isFocused();
|
||||
return this.view.isFocused();
|
||||
}
|
||||
|
||||
public domBlur(): void {
|
||||
|
||||
@@ -73,7 +73,13 @@ export class ListService implements IListService {
|
||||
|
||||
const result = combinedDisposable([
|
||||
widget.onDidFocus(() => this._lastFocusedWidget = widget),
|
||||
toDisposable(() => this.lists.splice(this.lists.indexOf(registeredList), 1))
|
||||
toDisposable(() => this.lists.splice(this.lists.indexOf(registeredList), 1)),
|
||||
widget.onDidDispose(() => {
|
||||
this.lists = this.lists.filter(l => l !== registeredList);
|
||||
if (this._lastFocusedWidget === widget) {
|
||||
this._lastFocusedWidget = undefined;
|
||||
}
|
||||
})
|
||||
]);
|
||||
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user