Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw when rendering disposed view #197844

Merged
merged 1 commit into from
Nov 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/vs/editor/browser/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as dom from 'vs/base/browser/dom';
import { Selection } from 'vs/editor/common/core/selection';
import { Range } from 'vs/editor/common/core/range';
import { FastDomNode, createFastDomNode } from 'vs/base/browser/fastDomNode';
import { onUnexpectedError } from 'vs/base/common/errors';
import { BugIndicatingError, onUnexpectedError } from 'vs/base/common/errors';
import { IDisposable } from 'vs/base/common/lifecycle';
import { IPointerHandlerHelper } from 'vs/editor/browser/controller/mouseHandler';
import { PointerHandler } from 'vs/editor/browser/controller/pointerHandler';
Expand Down Expand Up @@ -431,12 +431,18 @@ export class View extends ViewEventHandler {
}

private _scheduleRender(): void {
if (this._store.isDisposed) {
throw new BugIndicatingError();
}
if (this._renderAnimationFrame === null) {
this._renderAnimationFrame = dom.runAtThisOrScheduleAtNextAnimationFrame(dom.getWindow(this.domNode.domNode), this._onRenderScheduled.bind(this), 100);
}
}

private _onRenderScheduled(): void {
if (this._store.isDisposed) {
throw new BugIndicatingError();
}
this._renderAnimationFrame = null;
this._flushAccumulatedAndRenderNow();
}
Expand All @@ -457,6 +463,10 @@ export class View extends ViewEventHandler {
}

private _actualRender(): void {
if (this._store.isDisposed) {
throw new BugIndicatingError();
}

if (!this.domNode.domNode.isConnected) {
return;
}
Expand Down