Engine at DumpTools is not being disposed properly

Hello, we run into issue with using CreateScreenshotUsingRenderTargetAsync after one of the recent updates. After disposing of the engine and then creating new one (eg. exiting and entering product page again) running CreateScreenshotUsingRenderTargetAsync keeps returning latest image generated before exit.

I was able to trace down when the issue was introduced and it seems to appear in release 7.26.1. It was part of this PR Some Async Stuff by RaananW · Pull Request #15600 · BabylonJS/Babylon.js · GitHub

In general there was introduced _enginePromise variable at DumpTools which contains promise which returns object. And it isn’t cleared during disposal. So then during usage with new engine it keeps returning original object with reference to disposed engine instead of creating new one. In result we get image based on whatever was generated on this disposed engine kept in memory.

If needed I can created some example although I am not sure I can make it in playground. Although I hope it’s clear enough even without.

Thanks in advance.

cc @RaananW

of course, makes sense. the promise needs to be cleared, otherwise the engine stays in memory. i’ll fix it very soon.

1 Like