diff --git a/src/vs/workbench/api/browser/mainThreadWebview.ts b/src/vs/workbench/api/browser/mainThreadWebview.ts index 4dd8f5942889a..ca38f063be623 100644 --- a/src/vs/workbench/api/browser/mainThreadWebview.ts +++ b/src/vs/workbench/api/browser/mainThreadWebview.ts @@ -334,16 +334,16 @@ export class MainThreadWebviews extends Disposable implements extHostProtocol.Ma disposables.add(input.webview.onDidClickLink((uri: URI) => this.onDidClickLink(handle, uri))); disposables.add(input.webview.onMessage((message: any) => { this._proxy.$onMessage(handle, message); })); - disposables.add(input.onDisposeWebview(() => { - this._proxy.$onDidDisposeWebviewPanel(handle).finally(() => { - this._webviewInputs.delete(handle); - }); - })); disposables.add(input.webview.onMissingCsp((extension: ExtensionIdentifier) => this._proxy.$onMissingCsp(handle, extension.value))); input.onDispose(() => { disposables.dispose(); }); + input.onDisposeWebview(() => { + this._proxy.$onDidDisposeWebviewPanel(handle).finally(() => { + this._webviewInputs.delete(handle); + }); + }); } private updateWebviewViewStates() { diff --git a/src/vs/workbench/contrib/webview/browser/webviewEditorInput.ts b/src/vs/workbench/contrib/webview/browser/webviewEditorInput.ts index eb93008618860..662ee5acbd15f 100644 --- a/src/vs/workbench/contrib/webview/browser/webviewEditorInput.ts +++ b/src/vs/workbench/contrib/webview/browser/webviewEditorInput.ts @@ -90,11 +90,11 @@ export class WebviewInput extends EditorInput { } dispose() { - super.dispose(); if (!this._didSomeoneTakeMyWebview) { this._webview?.rawValue?.dispose(); this._onDisposeWebview.fire(); } + super.dispose(); } public getTypeId(): string {