@@ -9,6 +9,7 @@ import { IEditorModel } from 'vs/platform/editor/common/editor';
99import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions' ;
1010import { EditorInput , EditorModel , GroupIdentifier , IEditorInput } from 'vs/workbench/common/editor' ;
1111import { WebviewEditorOverlay } from 'vs/workbench/contrib/webview/common/webview' ;
12+ import { UnownedDisposable as Unowned } from 'vs/base/common/lifecycle' ;
1213
1314class WebviewIconsManager {
1415 private readonly _icons = new Map < string , { light : URI , dark : URI } > ( ) ;
@@ -58,6 +59,7 @@ export class WebviewEditorInput extends EditorInput {
5859 private _name : string ;
5960 private _iconPath ?: { light : URI , dark : URI } ;
6061 private _group ?: GroupIdentifier ;
62+ private readonly _webview : WebviewEditorOverlay ;
6163
6264 constructor (
6365 public readonly id : string ,
@@ -67,14 +69,14 @@ export class WebviewEditorInput extends EditorInput {
6769 readonly location : URI ;
6870 readonly id : ExtensionIdentifier ;
6971 } ,
70- public readonly webview : WebviewEditorOverlay ,
72+ webview : Unowned < WebviewEditorOverlay > ,
7173 ) {
7274 super ( ) ;
7375
7476 this . _name = name ;
7577 this . extension = extension ;
7678
77- this . _register ( webview ) ; // The input owns this webview
79+ this . _webview = this . _register ( webview . acquire ( ) ) ; // The input owns this webview
7880 }
7981
8082 public getTypeId ( ) : string {
@@ -105,6 +107,10 @@ export class WebviewEditorInput extends EditorInput {
105107 this . _onDidChangeLabel . fire ( ) ;
106108 }
107109
110+ public get webview ( ) {
111+ return this . _webview ;
112+ }
113+
108114 public get iconPath ( ) {
109115 return this . _iconPath ;
110116 }
@@ -147,7 +153,7 @@ export class RevivedWebviewEditorInput extends WebviewEditorInput {
147153 readonly id : ExtensionIdentifier
148154 } ,
149155 private readonly reviver : ( input : WebviewEditorInput ) => Promise < void > ,
150- webview : WebviewEditorOverlay ,
156+ webview : Unowned < WebviewEditorOverlay > ,
151157 ) {
152158 super ( id , viewType , name , extension , webview ) ;
153159 }
0 commit comments