`Effect._checkIsReady` infinite loop when dispose scene with DefaultRenderingPipeline again

This issue is followed by:

Here’s the code to reproduce the bug

const canvas = document.createElement("canvas");
const engine = new Engine(canvas);
const scene = new Scene(engine);
const defaultPipeline = new DefaultRenderingPipeline("default", true, scene);
defaultPipeline.prepare(); // uncomment this line to fix the issue

scene.dispose();
engine.dispose();

You can see it’s running in an infinite setTimeout loop like this

Here is the code to reproduce the issue for debugging.

Just in case you’re wondering if there’s any reason to write code to delete the engine as soon as it’s created.
I’m using babylon.js in react and I have some engine initialization code in useEffect callback where react’s strictmode is running a side effect twice and disposing of the first one.

This PR should fix the problem:

2 Likes

Thanks and good morning :slight_smile:

1 Like