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

Remove ! to improve safety #4328

Merged
merged 1 commit into from
Dec 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions addons/xterm-addon-webgl/src/WebglRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export class WebglRenderer extends Disposable implements IRenderer {

private _canvas: HTMLCanvasElement;
private _gl: IWebGL2RenderingContext;
private _rectangleRenderer!: RectangleRenderer;
private _glyphRenderer!: GlyphRenderer;
private _rectangleRenderer: RectangleRenderer;
private _glyphRenderer: GlyphRenderer;

public readonly dimensions: IRenderDimensions;

Expand Down Expand Up @@ -127,7 +127,7 @@ export class WebglRenderer extends Disposable implements IRenderer {

this._core.screenElement!.appendChild(this._canvas);

this._initializeWebGLState();
[this._rectangleRenderer, this._glyphRenderer] = this._initializeWebGLState();

this._isAttached = this._coreBrowserService.window.document.body.contains(this._core.screenElement!);

Expand Down Expand Up @@ -235,7 +235,7 @@ export class WebglRenderer extends Disposable implements IRenderer {
/**
* Initializes members dependent on WebGL context state.
*/
private _initializeWebGLState(): void {
private _initializeWebGLState(): [RectangleRenderer, GlyphRenderer] {
// Dispose any previous rectangle and glyph renderers before creating new ones.
this._rectangleRenderer?.dispose();
this._glyphRenderer?.dispose();
Expand All @@ -245,6 +245,8 @@ export class WebglRenderer extends Disposable implements IRenderer {

// Update dimensions and acquire char atlas
this.handleCharSizeChanged();

return [this._rectangleRenderer, this._glyphRenderer];
}

/**
Expand All @@ -268,7 +270,6 @@ export class WebglRenderer extends Disposable implements IRenderer {
this._coreBrowserService.dpr
);
if (this._charAtlas !== atlas) {

this._charAtlasDisposable?.dispose();
this._onChangeTextureAtlas.fire(atlas.pages[0].canvas);
this._charAtlasDisposable = getDisposeArrayDisposable([
Expand Down