From 8108d24f7c138094dff4b4a4f6995571ac03f11d Mon Sep 17 00:00:00 2001 From: Guillaume Grossetie Date: Tue, 11 Jun 2024 11:49:06 +0200 Subject: [PATCH] Check if WebView is disposed (before refreshing) (#842) --- src/features/preview.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/features/preview.ts b/src/features/preview.ts index e0f6dd06..ec2f5c25 100644 --- a/src/features/preview.ts +++ b/src/features/preview.ts @@ -229,6 +229,9 @@ export class AsciidocPreview extends Disposable implements WebviewResourceProvid this.editor.dispose() disposeAll(this.disposables) + + clearTimeout(this.throttleTimer) + this.throttleTimer = undefined } // This method is invoked evrytime there is a document update @@ -358,6 +361,10 @@ export class AsciidocPreview extends Disposable implements WebviewResourceProvid clearTimeout(this.throttleTimer) this.throttleTimer = undefined + if (this._disposed) { + return + } + const document = await vscode.workspace.openTextDocument(resource) if (!this.forceUpdate && this.currentVersion && this.currentVersion.resource.fsPath === resource.fsPath &&