Disposing Engine before Scene - is it just bad coding?


My experience with the IDisposable in c# has been that it’s meant to be an idempotent operation to cleanup unmanaged resources and should gracefully handle different scenarios. I’ve done quite a bit of low-level coding to metal many moons ago.

Depending on the order in which I tear down my scene and dispose an error occurs in ThinEngine:
Babylon.js Playground (babylonjs.com)

My question is then if this is considered a bug. I realize that it is logical and makes the most sense the Scene should be disposed before the Engine. This is a long way of asking if the order of disposing should be gracefully handled with maybe a guard clause by the framework itself.

Personally, I would expect all dispose methods to be idempotent. @deltakosh What do you think?

I do agree
Let me see how I can fix that issue

Will be fix in next nightly :wink:

1 Like