Skip to content

Commit c9feb6f

Browse files
committed
fix(canvas): clean up context
1 parent 03854aa commit c9feb6f

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

packages/canvas/Canvas/index.android.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,12 @@ export class Canvas extends CanvasBase {
308308

309309
disposeNativeView(): void {
310310
this._canvas.setListener(null);
311+
this._2dContext = undefined;
312+
this._webglContext = undefined;
313+
this._webgl2Context = undefined;
314+
this._gpuContext = undefined;
315+
this._contextType = ContextType.None;
316+
this._is2D = false;
311317
this._canvas = undefined;
312318
super.disposeNativeView();
313319
}

packages/canvas/Canvas/index.ios.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,12 @@ export class Canvas extends CanvasBase {
296296

297297
disposeNativeView(): void {
298298
this._canvas?.setListener?.(null);
299+
this._2dContext = undefined;
300+
this._webglContext = undefined;
301+
this._webgl2Context = undefined;
302+
this._gpuContext = undefined;
303+
this._contextType = ContextType.None;
304+
this._is2D = false;
299305
this._readyListener = undefined;
300306
this._canvas = undefined;
301307
super.disposeNativeView();

0 commit comments

Comments
 (0)