Skip to content

Commit

Permalink
Make sure we dispose of webviews in correct order
Browse files Browse the repository at this point in the history
Fixes #85621

We must fire the the dispose event before  disposing of the event
  • Loading branch information
mjbvz committed Nov 26, 2019
1 parent 776c33a commit a8158ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/vs/workbench/api/browser/mainThreadWebview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit a8158ae

Please sign in to comment.