Bug when disposing a line

Hello,

There’s a bug in the last version when you want to dispose a line mesh.

Here’s a PG : https://playground.babylonjs.com/#C77SMH#14

I did not see any breaking change about that so I assume it is a bug but i’m not quite sure.

Thanks in advance,

Boris

1 Like

Just adding to this, dispose() seems to be failing as it’s looking for the line’s material and fails if it hasn’t been defined.

I think it’s related to the default material creation on lineMesh. Last commit doesn’t create the default material immediately but instead calls “initShaderSourceAsync”:

This function awaits for the shaders to be loaded and only then creates the default material. However, initShaderSourceAsync cannot be awaited by the constructor, which means that calling dispose() right after the mesh creation will fail to find the material (as it hasn’t been created yet).

This can be confirmed by setting a timeout to dispose the line:

1 Like

good catch!!
I’ll send a PR to fix that

1 Like

Will be fix by this PR:
More Postprocesses ported to webgpu by deltakosh · Pull Request #15447 · BabylonJS/Babylon.js (github.com)

3 Likes