Skip to content

Make sure child instantiation service instances are disposed/tracked for disposal (#212879) #213002

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 19, 2024
Merged
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
4 changes: 2 additions & 2 deletions src/vs/workbench/browser/parts/compositePart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,9 @@ export abstract class CompositePart<T extends Composite> extends Part {
this._register(that.onDidCompositeClose.event(e => this.onScopeClosed(e.getId())));
}
}());
const compositeInstantiationService = this.instantiationService.createChild(new ServiceCollection(
const compositeInstantiationService = this._register(this.instantiationService.createChild(new ServiceCollection(
[IEditorProgressService, compositeProgressIndicator] // provide the editor progress service for any editors instantiated within the composite
));
)));

const composite = compositeDescriptor.instantiate(compositeInstantiationService);
const disposable = new DisposableStore();
Expand Down
4 changes: 2 additions & 2 deletions src/vs/workbench/browser/parts/editor/auxiliaryEditorPart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,10 @@ export class AuxiliaryEditorPart {
auxiliaryWindow.layout();

// Have a InstantiationService that is scoped to the auxiliary window
const instantiationService = this.instantiationService.createChild(new ServiceCollection(
const instantiationService = disposables.add(this.instantiationService.createChild(new ServiceCollection(
[IStatusbarService, this.statusbarService.createScoped(statusbarPart, disposables)],
[IEditorService, this.editorService.createScoped(editorPart, disposables)]
));
)));

return {
part: editorPart,
Expand Down
4 changes: 2 additions & 2 deletions src/vs/workbench/browser/parts/editor/editorGroupView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,10 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
this.progressBar.hide();

// Scoped instantiation service
this.scopedInstantiationService = this.instantiationService.createChild(new ServiceCollection(
this.scopedInstantiationService = this._register(this.instantiationService.createChild(new ServiceCollection(
[IContextKeyService, this.scopedContextKeyService],
[IEditorProgressService, this._register(new EditorProgressIndicator(this.progressBar, this))]
));
)));

// Context keys
this.resourceContext = this._register(this.scopedInstantiationService.createInstance(ResourceContextKey));
Expand Down
4 changes: 2 additions & 2 deletions src/vs/workbench/browser/parts/editor/editorPart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -978,9 +978,9 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupsView {

// Scoped instantiation service
const scopedContextKeyService = this._register(this.contextKeyService.createScoped(this.container));
this.scopedInstantiationService = this.instantiationService.createChild(new ServiceCollection(
this.scopedInstantiationService = this._register(this.instantiationService.createChild(new ServiceCollection(
[IContextKeyService, scopedContextKeyService]
));
)));

// Grid control
this._willRestoreState = !options || options.restorePreviousState;
Expand Down
4 changes: 2 additions & 2 deletions src/vs/workbench/browser/parts/editor/editorStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -893,9 +893,9 @@ export class EditorStatusContribution extends Disposable implements IWorkbenchCo
super();

// Main Editor Status
const mainInstantiationService = instantiationService.createChild(new ServiceCollection(
const mainInstantiationService = this._register(instantiationService.createChild(new ServiceCollection(
[IEditorService, editorService.createScoped('main', this._store)]
));
)));
this._register(mainInstantiationService.createInstance(EditorStatus, mainWindow.vscodeWindowId));

// Auxiliary Editor Status
Expand Down
4 changes: 2 additions & 2 deletions src/vs/workbench/browser/parts/editor/editorTabsControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ export abstract class EditorTabsControl extends Themable implements IEditorTabsC
super(themeService);

this.contextMenuContextKeyService = this._register(this.contextKeyService.createScoped(parent));
const scopedInstantiationService = this.instantiationService.createChild(new ServiceCollection(
const scopedInstantiationService = this._register(this.instantiationService.createChild(new ServiceCollection(
[IContextKeyService, this.contextMenuContextKeyService],
));
)));

this.resourceContext = this._register(scopedInstantiationService.createInstance(ResourceContextKey));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ class LanguageStatusContribution extends Disposable implements IWorkbenchContrib
super();

// --- main language status
const mainInstantiationService = instantiationService.createChild(new ServiceCollection(
const mainInstantiationService = this._register(instantiationService.createChild(new ServiceCollection(
[IEditorService, editorService.createScoped('main', this._store)]
));
)));
this._register(mainInstantiationService.createInstance(LanguageStatus));

// --- auxiliary language status
Expand Down