Closed Debenben closed 4 months ago
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). To prevent this PR from going to the changelog marked it with the "skip changelog" label.
Snapshot stored with reference name: refs/pull/15116/merge
Test environment: https://babylonsnapshots.z22.web.core.windows.net/refs/pull/15116/merge/index.html
To test a playground add it to the URL, for example:
https://babylonsnapshots.z22.web.core.windows.net/refs/pull/15116/merge/index.html#WGZLGJ#4600
Links to test babylon tools with this snapshot:
https://playground.babylonjs.com/?snapshot=refs/pull/15116/merge https://sandbox.babylonjs.com/?snapshot=refs/pull/15116/merge https://gui.babylonjs.com/?snapshot=refs/pull/15116/merge https://nme.babylonjs.com/?snapshot=refs/pull/15116/merge
To test the snapshot in the playground with a playground ID add it after the snapshot query string:
https://playground.babylonjs.com/?snapshot=refs/pull/15116/merge#BCU1XR#0
WebGL2 visualization test reporter:
Visualization tests for WebGPU (Experimental) Important - these might fail sporadically. This is an optional test.
How do you repro the issue?
I have no problem with that fix but curious to see how it can happen
The crash can be reproduced like this:
var advancedTexture = BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI("ui");
var control = new BABYLON.GUI.TextBlock("control");
var panel1 = new BABYLON.GUI.StackPanel("panel1");
panel1.addControl(control);
advancedTexture.addControl(panel1);
var panel2 = new BABYLON.GUI.StackPanel("panel2");
//panel1 is added to texture, but not panel2
panel2.addControl(control); // <-- crashes here
In my code I needed to rearrange controls in a stackpanel. There are probably better ways to do this, but at the time I used a temporary stack panel here: https://github.com/Debenben/babyele/blob/master/src/guimodeselection.ts#L206
fix Uncaught TypeError: Cannot read properties of undefined (reading 'getScene')
When trying to use BabylonJS version 7.6.0 or later I get a crash, I believe this proposed change should fix it, if there is more to it let me know and I can share the complete setup to reproduce the crash.