Crash with DynamicTexture disposal using web worker

Hi everyone !

I have a issue while trying to dispose a dynamicTexture which has beed created in a babylon thread running on a web worker.

     * Disposes the dynamic texture.
    public dispose(): void {

        if (this._ownCanvas) {
        (this._canvas as any) = null;
        (this._context as any) = null;

this._ownCanvas is set to true but refers to an OffScreenCanvas, which does not implements the “remove” function.

The code runs well if I disable the worker, as the canvas of the DynamicTexture is then a simple HTMLCanvasElement which inherits Element.

Thank for any help !

makes sense.

OffscreenCanvas doesn’t have the remove function by RaananW · Pull Request #14807 · BabylonJS/Babylon.js (


Thanks for the quick PR !

1 Like