Skip to content

Commit

Permalink
Check if WebView is disposed (before refreshing) (#842)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggrossetie committed Jun 11, 2024
1 parent 39a3e20 commit 8108d24
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/features/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 &&
Expand Down

0 comments on commit 8108d24

Please sign in to comment.