Skip to content

Commit

Permalink
Make sure child instantiation service instances are disposed/tracked …
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero authored and johnyongbeyondsoft committed May 20, 2024
1 parent 6b17747 commit 6d6fc3d
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
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

0 comments on commit 6d6fc3d

Please sign in to comment.