Repository: godot
Issue: Segfault when running a game, no Godot debugger errors
Labels: bug,topic:core,needs testing,crash

### Godot version

4.0 beta 6 and latest master

### System information

Arch Linux

### Issue description

When running the main scene of my game, it crashes on startup without giving any errors in Godot editor's debugger.

I have run the game in gdb and here's the backtrace:

```gdb
Thread 1 "godot.linuxbsd." received signal SIGSEGV, Segmentation fault.
0x0000555559eb6951 in Object::notification (this=0x55556251cc40, p_notification=1, p_reversed=true) at core/object/object.cpp:790
790             _notificationv(p_notification, p_reversed);
(gdb) bt
#0  0x0000555559eb6951 in Object::notification (this=0x55556251cc40, p_notification=1, p_reversed=true) at core/object/object.cpp:790
#1  0x0000555559eb9a1a in Object::_predelete (this=this@entry=0x55556251cc40) at core/object/object.cpp:196
#2  predelete_handler (p_object=p_object@entry=0x55556251cc40) at core/object/object.cpp:1840
#3  0x0000555558043a60 in memdelete<Node> (p_class=0x55556251cc40) at ./core/os/memory.h:104
#4  Node::_notification (this=0x555562528310, p_notification=<optimized out>) at scene/main/node.cpp:169
#5  0x0000555559eb6954 in Object::notification (this=0x555562528310, p_notification=1, p_reversed=<optimized out>) at core/object/object.cpp:790
#6  0x0000555559eb7069 in Object::_predelete (this=0x555562528310) at core/object/object.cpp:196
#7  predelete_handler (p_object=0x555562528310) at core/object/object.cpp:1840
#8  memdelete<Object> (p_class=0x555562528310) at ./core/os/memory.h:105
#9  Object::callp (this=0x555562528310, p_method=..., p_args=0x7fffffffb5a0, p_argcount=0, r_error=...) at core/object/object.cpp:702
#10 0x0000555559c838ca in Variant::callp (this=<optimized out>, p_method=..., p_args=0x7fffffffb5a0, p_argcount=0, r_ret=..., r_error=...) at core/variant/variant_call.cpp:1048
#11 0x0000555556478f51 in GDScriptFunction::call (this=<optimized out>, p_instance=<optimized out>, p_instance@entry=0x555562589390, p_args=p_args@entry=0x7fffffffbb60, p_argcount=p_argcount@entry=0, r_err=..., p_state=<optimized out>) at modules/gdscript/gdscript_vm.cpp:1555
#12 0x000055555634982d in GDScriptInstance::callp (this=0x555562589390, p_method=..., p_args=0x7fffffffbb60, p_argcount=0, r_error=...) at modules/gdscript/gdscript.cpp:1827
#13 0x0000555559eb7034 in Object::callp (this=0x555562589430, p_method=..., p_args=0x7fffffffbb60, p_argcount=0, r_error=...) at core/object/object.cpp:711
#14 0x0000555559c838ca in Variant::callp (this=<optimized out>, p_method=..., p_args=0x7fffffffbb60, p_argcount=0, r_ret=..., r_error=...) at core/variant/variant_call.cpp:1048
#15 0x0000555556478f51 in GDScriptFunction::call (this=<optimized out>, p_instance=<optimized out>, p_instance@entry=0x555562589390, p_args=p_args@entry=0x7fffffffc1b0, p_argcount=p_argcount@entry=1, r_err=..., p_state=<optimized out>) at modules/gdscript/gdscript_vm.cpp:1555
#16 0x000055555634982d in GDScriptInstance::callp (this=0x555562589390, p_method=..., p_args=0x7fffffffc1b0, p_argcount=1, r_error=...) at modules/gdscript/gdscript.cpp:1827
#17 0x0000555559eb7034 in Object::callp (this=0x555562589430, p_method=..., p_args=0x7fffffffc1b0, p_argcount=1, r_error=...) at core/object/object.cpp:711
#18 0x0000555559c838ca in Variant::callp (this=<optimized out>, p_method=..., p_args=0x7fffffffc1b0, p_argcount=1, r_ret=..., r_error=...) at core/variant/variant_call.cpp:1048
#19 0x0000555556478f51 in GDScriptFunction::call (this=<optimized out>, p_instance=<optimized out>, p_instance@entry=0x555562589390, p_args=p_args@entry=0x0, p_argcount=p_argcount@entry=0, r_err=..., p_state=<optimized out>) at modules/gdscript/gdscript_vm.cpp:1555
#20 0x000055555634982d in GDScriptInstance::callp (this=0x555562589390, p_method=..., p_args=0x0, p_argcount=0, r_error=...) at modules/gdscript/gdscript.cpp:1827
#21 0x0000555558044856 in Node::_gdvirtual__ready_call<false> (this=0x555562589430) at scene/main/node.h:241
#22 Node::_notification (this=0x555562589430, p_notification=<optimized out>) at scene/main/node.cpp:154
#23 0x000055555854100d in Node::_notificationv (p_reversed=false, p_notification=13, this=0x555562589430) at ./scene/main/node.h:45
#24 Node3D::_notificationv (this=0x555562589430, p_notification=13, p_reversed=<optimized out>) at scene/3d/node_3d.h:52
#25 0x0000555559eb6954 in Object::notification (this=0x555562589430, p_notification=13, p_reversed=<optimized out>) at core/object/object.cpp:790
#26 0x0000555558036026 in Node::_propagate_ready (this=0x555562589430) at scene/main/node.cpp:187
#27 0x0000555558035fc2 in Node::_propagate_ready (this=0x555562528310) at scene/main/node.cpp:179
#28 0x0000555558037ad7 in Node::_set_tree (this=0x555562528310, p_tree=0x55555f951800) at scene/main/node.cpp:2533
#29 0x0000555558042bb4 in Node::_add_child_nocheck (this=0x555561770e30, p_child=0x555562528310, p_name=...) at scene/main/node.cpp:1117
#30 0x0000555558042d34 in Node::add_child (this=0x555561770e30, p_child=0x555562528310, p_force_readable_name=<optimized out>, p_internal=Node::INTERNAL_MODE_DISABLED) at scene/main/node.cpp:1136
#31 0x000055555805553c in call_with_variant_args_helper<__UnexistingClass, Node*, bool, Node::InternalMode, 0ul, 1ul, 2ul> (r_error=..., p_args=0x7fffffffc7d0, p_method=<optimized out>, p_instance=<optimized out>) at ./core/variant/binder_common.h:262
#32 call_with_variant_args_dv<__UnexistingClass, Node*, bool, Node::InternalMode> (default_values=..., r_error=..., p_argcount=<optimized out>, p_args=<optimized out>, p_method=<optimized out>, p_instance=<optimized out>) at ./core/variant/binder_common.h:409
#33 MethodBindT<Node*, bool, Node::InternalMode>::call (this=<optimized out>, p_object=<optimized out>, p_args=<optimized out>, p_arg_count=<optimized out>, r_error=...) at ./core/object/method_bind.h:320
#34 0x0000555556479002 in GDScriptFunction::call (this=<optimized out>, p_instance=<optimized out>, p_instance@entry=0x555560cf7d50, p_args=p_args@entry=0x0, p_argcount=p_argcount@entry=0, r_err=..., p_state=<optimized out>) at modules/gdscript/gdscript_vm.cpp:1644
#35 0x000055555634982d in GDScriptInstance::callp (this=0x555560cf7d50, p_method=..., p_args=0x0, p_argcount=0, r_error=...) at modules/gdscript/gdscript.cpp:1827
#36 0x0000555558044856 in Node::_gdvirtual__ready_call<false> (this=0x55555eb9fec0) at scene/main/node.h:241
#37 Node::_notification (this=0x55555eb9fec0, p_notification=<optimized out>) at scene/main/node.cpp:154
#38 0x0000555559eb6954 in Object::notification (this=0x55555eb9fec0, p_notification=13, p_reversed=<optimized out>) at core/object/object.cpp:790
#39 0x0000555558036026 in Node::_propagate_ready (this=0x55555eb9fec0) at scene/main/node.cpp:187
#40 0x0000555558037ad7 in Node::_set_tree (this=0x55555eb9fec0, p_tree=0x55555f951800) at scene/main/node.cpp:2533
#41 0x0000555558042bb4 in Node::_add_child_nocheck (this=0x55555f958b50, p_child=0x55555eb9fec0, p_name=...) at scene/main/node.cpp:1117
#42 0x0000555558042d34 in Node::add_child (this=0x55555f958b50, p_child=0x55555eb9fec0, p_force_readable_name=<optimized out>, p_internal=Node::INTERNAL_MODE_DISABLED) at scene/main/node.cpp:1136
#43 0x000055555805553c in call_with_variant_args_helper<__UnexistingClass, Node*, bool, Node::InternalMode, 0ul, 1ul, 2ul> (r_error=..., p_args=0x7fffffffcfe0, p_method=<optimized out>, p_instance=<optimized out>) at ./core/variant/binder_common.h:262
#44 call_with_variant_args_dv<__UnexistingClass, Node*, bool, Node::InternalMode> (default_values=..., r_error=..., p_argcount=<optimized out>, p_args=<optimized out>, p_method=<optimized out>, p_instance=<optimized out>) at ./core/variant/binder_common.h:409
#45 MethodBindT<Node*, bool, Node::InternalMode>::call (this=<optimized out>, p_object=<optimized out>, p_args=<optimized out>, p_arg_count=<optimized out>, r_error=...) at ./core/object/method_bind.h:320
#46 0x0000555556479002 in GDScriptFunction::call (this=<optimized out>, p_instance=<optimized out>, p_instance@entry=0x55555ff7bb60, p_args=p_args@entry=0x7fffffffd798, p_argcount=p_argcount@entry=0, r_err=..., p_state=<optimized out>) at modules/gdscript/gdscript_vm.cpp:1644
#47 0x000055555634982d in GDScriptInstance::callp (this=0x55555ff7bb60, p_method=..., p_args=0x7fffffffd798, p_argcount=0, r_error=...) at modules/gdscript/gdscript.cpp:1827
#48 0x0000555559eb7034 in Object::callp (this=0x555560203d50, p_method=..., p_args=0x7fffffffd798, p_argcount=0, r_error=...) at core/object/object.cpp:711
#49 0x0000555559c838ca in Variant::callp (this=<optimized out>, p_method=..., p_args=0x7fffffffd798, p_argcount=0, r_ret=..., r_error=...) at core/variant/variant_call.cpp:1048
#50 0x0000555556478f51 in GDScriptFunction::call (this=<optimized out>, p_instance=<optimized out>, p_instance@entry=0x55555ff7bb60, p_args=p_args@entry=0x7fffffffdb98, p_argcount=p_argcount@entry=1, r_err=..., p_state=<optimized out>) at modules/gdscript/gdscript_vm.cpp:1555
#51 0x000055555634982d in GDScriptInstance::callp (this=0x55555ff7bb60, p_method=..., p_args=0x7fffffffdb98, p_argcount=1, r_error=...) at modules/gdscript/gdscript.cpp:1827
--Type <RET> for more, q to quit, c to continue without paging--c
#52 0x00005555580440e4 in Node::_gdvirtual__process_call<false> (arg1=0.016648, this=0x555560203d50) at scene/main/node.h:237
#53 Node::_notification (this=0x555560203d50, p_notification=<optimized out>) at scene/main/node.cpp:56
#54 0x0000555558192e70 in Node::_notificationv (p_reversed=false, p_notification=17, this=0x555560203d50) at ./scene/main/node.h:45
#55 CanvasItem::_notificationv (p_reversed=false, p_notification=17, this=0x555560203d50) at ./scene/main/canvas_item.h:45
#56 Control::_notificationv (this=0x555560203d50, p_notification=17, p_reversed=<optimized out>) at scene/gui/control.h:47
#57 0x0000555559eb6954 in Object::notification (this=0x555560203d50, p_notification=17, p_reversed=<optimized out>) at core/object/object.cpp:790
#58 0x00005555580730f0 in SceneTree::_notify_group_pause (this=0x55555f951800, p_group=..., p_notification=17) at scene/main/scene_tree.cpp:871
#59 0x0000555558074fef in SceneTree::process (this=0x55555f951800, p_time=0.016648) at scene/main/scene_tree.cpp:469
#60 0x00005555560194a3 in Main::iteration () at main/main.cpp:3183
#61 0x0000555555fcc3d1 in OS_LinuxBSD::run (this=this@entry=0x7fffffffdea0) at platform/linuxbsd/os_linuxbsd.cpp:799
#62 0x0000555555fbe2e9 in main (argc=<optimized out>, argv=0x7fffffffe3f8) at platform/linuxbsd/godot_linuxbsd.cpp:73
```

### Steps to reproduce

The only way to reproduce the issue I know is to basically run my game from the branch that has this problem.

1. Clone the game repository

```
git clone https://codeberg.org/Liblast/Liblast.git`
cd Liblast
# without LFS the game won't have any assets and won't run
git lfs install
git lfs pull
# checkout the branch that has the issue
git checkout g4-beta6-update
# or the exact commit I am on right now:
git checkout 73aabbe
```

2. Open the game in the editor to import all the assets
The game project resides in `Liblast/Game`.
4. Start the game's main scene by hitting F5
5. See it crash without any clues

Not everything crashes the game however.
For example if you run the game with `--dedicated-host` argument, it'll not load the `Main.tscn` but `Dedicated.tscn` and this one does not crash.

### Minimal reproduction project

I have no idea on what is going on so I can't provide an MRP.