Multiview Dynamically Remove View, Renderloop Problem

So I have been struggling with something that is prolly dumb…

First what I am doing is I have an app where views are created when their scene asynchronous compiles. They usually finish is order, but there is no guarantee that they will be in the same order in the array holding them each time the page loads.

Here is an example of the problem, not being a problem:
https://playground.babylonjs.com/#LEIZ83#8

Views are added, they are later spliced from the list and dropped from the render stack and other things.

Now when I randomly remove the view from the array which is closer to what is happening in my app, we get this error:
https://playground.babylonjs.com/#LEIZ83#14
babylon.js:16 Uncaught DOMException: Failed to execute ‘drawImage’ on ‘CanvasRenderingContext2D’: The image argument is a canvas element with a width or height of 0.

On my application I have really gone over this and no matter what order I remove the view/scene, and make sure they are not even referenced in the engine object as soon as the DOM context is removed that same error pops up.

I’ve also noticed that if you remove the view, then dispose the scene you will remove extra views that are not even associated with the scene you disposed?

found the solution… it was a bug.

1 Like

Excellent catch!!! thanks a lot for the fix my friend!