Repository: godot
Issue: Godot 4.0 crashes when linking scene
Labels: bug,topic:editor,crash

### Godot version

v4.0.alpha.custom_build (690fefe43ee74c0ae3ed5642f3aefbeb711f9d1c)

### System information

Ubuntu 20.04.3 LTS Memory: 31.3 GB

### Issue description

After creating two scenes with no shared dependencies, using the "Instance Child Scene" button (otherwise known as linking a scene) to put one scene inside the other causes Godot to crash with the following message:

```
================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.0.alpha.custom_build (690fefe43ee74c0ae3ed5642f3aefbeb711f9d1c)
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /lib/x86_64-linux-gnu/libc.so.6(+0x430c0) [0x7f612d6180c0] (??:0)
[2] /lib/x86_64-linux-gnu/libc.so.6(getc+0xd) [0x7f612d66045d] (??:0)
[3] /home/evannibbe/godot/bin/godot.linuxbsd.opt.tools.64(+0x29410cf) [0x5602e357f0cf] (??:0)
[4] /home/evannibbe/godot/bin/godot.linuxbsd.opt.tools.64(+0x4afe111) [0x5602e573c111] (??:0)
[5] /home/evannibbe/godot/bin/godot.linuxbsd.opt.tools.64(+0x129bb3f) [0x5602e1ed9b3f] (??:0)
[6] /home/evannibbe/godot/bin/godot.linuxbsd.opt.tools.64(+0x12f22af) [0x5602e1f302af] (??:0)
[7] /home/evannibbe/godot/bin/godot.linuxbsd.opt.tools.64(+0x2476b42) [0x5602e30b4b42] (??:0)
[8] /home/evannibbe/godot/bin/godot.linuxbsd.opt.tools.64(+0x247948f) [0x5602e30b748f] (??:0)
…
[25] /home/evannibbe/godot/bin/godot.linuxbsd.opt.tools.64(+0x2dab30c) [0x5602e39e930c] (??:0)
[26] /home/evannibbe/godot/bin/godot.linuxbsd.opt.tools.64(+0x2d49fb1) [0x5602e3987fb1] (??:0)
[27] /home/evannibbe/godot/bin/godot.linuxbsd.opt.tools.64(+0x2df207b) [0x5602e3a3007b] (??:0)
[28] /home/evannibbe/godot/bin/godot.linuxbsd.opt.tools.64(+0x2e4309f) [0x5602e3a8109f] (??:0)
[29] /home/evannibbe/godot/bin/godot.linuxbsd.opt.tools.64(+0x2e48b4f) [0x5602e3a86b4f] (??:0)
[30] /home/evannibbe/godot/bin/godot.linuxbsd.opt.tools.64(+0x2dad24a) [0x5602e39eb24a] (??:0)
[31] /home/evannibbe/godot/bin/godot.linuxbsd.opt.tools.64(+0x2d9f3aa) [0x5602e39dd3aa] (??:0)
[32] /home/evannibbe/godot/bin/godot.linuxbsd.opt.tools.64(+0x146d501) [0x5602e20ab501] (??:0)
[33] /home/evannibbe/godot/bin/godot.linuxbsd.opt.tools.64(+0x4b5c99e) [0x5602e579a99e] (??:0)
[34] /home/evannibbe/godot/bin/godot.linuxbsd.opt.tools.64(+0x14c6054) [0x5602e2104054] (??:0)
[35] /home/evannibbe/godot/bin/godot.linuxbsd.opt.tools.64(+0x14c82bd) [0x5602e21062bd] (??:0)
[36] /home/evannibbe/godot/bin/godot.linuxbsd.opt.tools.64(+0x4b635e4) [0x5602e57a15e4] (??:0)
[37] /home/evannibbe/godot/bin/godot.linuxbsd.opt.tools.64(+0xd44500) [0x5602e1982500] (??:0)
[38] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0x7f612d5f90b3] (??:0)
[39] /home/evannibbe/godot/bin/godot.linuxbsd.opt.tools.64(+0xd552ee) [0x5602e19932ee] (??:0)
-- END OF BACKTRACE --
================================================================
```

Create a new project.
Create a scene with a Node3D root called "world"
Create a scene with a RigidDynamicBody3D root called "Opponent"
save both scenes with those respective names as .tscn files.
Go to the world scene and click "Instance Child Scene" then select Opponent.tscn in the menu.

Any time I try to reopen the same project where I linked the scenes, Godot 4.0 immediately crashes.

### Steps to reproduce

On Linux, download either alpha 5 or the code available on GitHub for this project as of April 17th at 23:56 Central Time (Chicago).
Edit line 1347 of drivers/vulkan/rendering_device_vulkan.cpp by commenting it out (otherwise it gave me a continuous stream of messages saying that a buffer can't be allocated with size 0)
Edit line 2707 at the word buffer_size to instead use MAX(buffer_size, MAX(width*height*depth, width*height))
Edit servers/rendering_server.h:84 to MAX_MESH_SURFACES=1000000 (otherwise line 243 of servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp was giving me a long line of non-fatal errors that don't seem to affect performance, note: I have also tried running the code without this edit, and got the same result on linking, so I would argue that this edit just makes the engine better and is not the cause of the crash.)
Compile the code with:
scons platform=linuxbsd target=release_debug use_lto=yes CXXFLAGS=-O3

Create a new project.
Create a scene with a Node3D root called "world"
Create a scene with a RigidDynamicBody3D root called "Opponent"
save both scenes with those respective names as .tscn files.
Go to the world scene and click "Instance Child Scene" then select Opponent.tscn in the menu.


### Minimal reproduction project

_No response_