Repository: godotengine/godot (language: cpp)

Issue:
Project crashes when pressing any key in v4.4-dev6 and when rolling back to v4.4-dev5 (custom editor shortcuts)
### Tested versions

- v4.4.dev.custom_build.0c45ace15
  - Build made to revert the CPU consumption from 4.4-dev5.
- v4.4-dev6

### System information

windows 10, Forward+, GTX 1660, Ryzen 3300x, 16GB RAM

### Issue description

If I execute the project and press any keys in the keyboard the project crashes leaving the following trace:

```
Godot Engine v4.4.dev6.official.1f47e4c4e - https://godotengine.org
Vulkan 1.3.289 - Forward+ - Using Device #0: NVIDIA - NVIDIA GeForce GTX 1660

(Virtual Joystick) The Project Setting 'emulate_mouse_from_touch' should be set to False
(Virtual Joystick) The Project Setting 'emulate_touch_from_mouse' should be set to True

================================================================
CrashHandlerException: Program crashed with signal 11
Engine version: Godot Engine v4.4.dev6.official (1f47e4c4e3a09a422e96880a7918d986dd575a63)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] error(-1): no debug info in PE/COFF executable
[2] error(-1): no debug info in PE/COFF executable
[3] error(-1): no debug info in PE/COFF executable
[4] error(-1): no debug info in PE/COFF executable
[5] error(-1): no debug info in PE/COFF executable
[6] error(-1): no debug info in PE/COFF executable
[7] error(-1): no debug info in PE/COFF executable
[8] error(-1): no debug info in PE/COFF executable
[9] error(-1): no debug info in PE/COFF executable
[10] error(-1): no debug info in PE/COFF executable
[11] error(-1): no debug info in PE/COFF executable
[12] error(-1): no debug info in PE/COFF executable
[13] error(-1): no debug info in PE/COFF executable
[14] error(-1): no debug info in PE/COFF executable
[15] error(-1): no debug info in PE/COFF executable
[16] error(-1): no debug info in PE/COFF executable
[17] error(-1): no debug info in PE/COFF executable
[18] error(-1): no debug info in PE/COFF executable
[19] error(-1): no debug info in PE/COFF executable
[20] error(-1): no debug info in PE/COFF executable
[21] error(-1): no debug info in PE/COFF executable
[22] error(-1): no debug info in PE/COFF executable
[23] error(-1): no debug info in PE/COFF executable
[24] error(-1): no debug info in PE/COFF executable
-- END OF BACKTRACE --
================================================================
```

```
Godot Engine v4.4.dev.custom_build.0c45ace15 (2024-11-22 20:54:49 UTC) - https://godotengine.org
Vulkan 1.3.289 - Forward+ - Using Device #0: NVIDIA - NVIDIA GeForce GTX 1660

(Virtual Joystick) The Project Setting 'emulate_mouse_from_touch' should be set to False
(Virtual Joystick) The Project Setting 'emulate_touch_from_mouse' should be set to True
ERROR: 1 RID allocations of type 'class RendererRD::TextureStorage::Texture' were leaked at exit.
ERROR: Parameter "RenderingServer::get_singleton()" is null.
   at: CompressedTexture2D::~CompressedTexture2D (scene\resources\compressed_texture.cpp:464)
ing the bug to the project developer.
[0] <couldn't map PC to fn name>
[1] <couldn't map PC to fn name>
[2] <couldn't map PC to fn name>
[3] <couldn't map PC to fn name>
[4] <couldn't map PC to fn name>
[5] <couldn't map PC to fn name>
[6] <couldn't map PC to fn name>
[7] <couldn't map PC to fn name>
[8] <couldn't map PC to fn name>
[9] <couldn't map PC to fn name>
[10] <couldn't map PC to fn name>
[11] <couldn't map PC to fn name>
[12] <couldn't map PC to fn name>
[13] <couldn't map PC to fn name>
[14] <couldn't map PC to fn name>
[15] <couldn't map PC to fn name>
[16] <couldn't map PC to fn name>
[17] <couldn't map PC to fn name>
[18] <couldn't map PC to fn name>
[19] <couldn't map PC to fn name>
[20] <couldn't map PC to fn name>
[21] <couldn't map PC to fn name>
[22] <couldn't map PC to fn name>
-- END OF BACKTRACE --
================================================================
```

I was using 4.4-dev5 as I needed a new feature regarding RPCs. I had to go to v4.4.dev.custom_build.0c45ace15 to revert the Clock Syncing changes that were making impossible to work in my project. I then upgraded to 4.4-dev6.

Now, the project crashes even if I go back to v4.4.dev.custom_build.0c45ace15.


I've tried deleting the `.godot` , `appdata/local/godot` and the `appdata/roaming/godot/app_userdata/_project_name_/`folder after rolling back to v4.4.dev.custom_build.0c45ace15, but still crashes.


### Steps to reproduce

:/

### Minimal reproduction project (MRP)

This is happening in my main project.


Discussion / hints:
Without the project no one can help you (and the trace is useless)
> Without the project no one can help you (and the trace is useless)

I know you mean well, but this sounds quite dismissive, please pay attention to the way you phrase things.

----

@caioraphael1 Can you try making your custom build with `debug_symbols=yes`, which should add debug symbols and produce a more useful stacktrace?

The problem might be related to changes in the InputMap. Could you share the contents of your control mappings in `project.godot`? Also if you're using version control, you can check if/how that file changed in successive upgrades.
I couldn't reproduce this in a simple project.

If you can't share the project or a MRP that triggers the issue, it would also be helpful if you could try to figure out what feature your project is using that might trigger this issue.

I notice this in the logs:
```
(Virtual Joystick) The Project Setting 'emulate_mouse_from_touch' should be set to False
(Virtual Joystick) The Project Setting 'emulate_touch_from_mouse' should be set to True
```

That's not a Godot message, I assume it comes from a thirdparty plugin?
Given the message text I think the plugin is:
* https://github.com/MarcoFazioRandom/Virtual-Joystick-Godot/
Same issue here with 4.4dev6 and corresponding godot_cpp from Master. On debug start I observe various gdextension controls firing _ready() and completing, but it crashes before the next control in the tree fires. Lib is built with debug_symbols=yes. VS reporting "exited with code 3221225477 (0xc0000005) Access violation". In the meantime I'll keep checking my code to see if I've missed a nullptr assignment and will post if any progress.

```
UIPanelCommands::_ready()
UIPanelCommands::_ready()...complete
UIPanelCharacterStats::_ready()
UIPanelCharacterStats::_ready()...complete
UIControlWorkPriorities::_ready()
UIControlWorkPriorities::_ready()...complete
UIPanelWork::_ready()
UIPanelWork::_ready()...complete
UIControlTabButton::_ready()
UIControlTabButton::_ready()...complete
UIControlTabButton::_ready()
UIControlTabButton::_ready()...complete

================================================================
CrashHandlerException: Program crashed with signal 11
Engine version: Godot Engine v4.4.dev6.official (1f47e4c4e3a09a422e96880a7918d986dd575a63)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] error(-1): no debug info in PE/COFF executable
[2] error(-1): no debug info in PE/COFF executable
[3] error(-1): no debug info in PE/COFF executable
[4] error(-1): no debug info in PE/COFF executable
...snip...
[25] error(-1): no debug info in PE/COFF executable
[26] error(-1): no debug info in PE/COFF executable
[27] error(-1): no debug info in PE/COFF executable
[28] error(-1): no debug info in PE/COFF executable
-- END OF BACKTRACE --
================================================================
```

Debug output from VS2022:
```
'Godot_v4.4-dev6_win64_console.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'. 
'Godot_v4.4-dev6_win64_console.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'. 
'Godot_v4.4-dev6_win64_console.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'. 
'Godot_v4.4-dev6_win64_console.exe' (Win32): Loaded 'C:\Windows\System32\msvcrt.dll'. 
'Godot_v4.4-dev6_win64_console.exe' (Win32): Loaded 'C:\Windows\System32\shlwapi.dll'. 
'Godot_v4.4-dev6_win64_console.exe' (Win32): Loaded 'C:\Windows\System32\version.dll'. 
The thread 6204 has exited with code 0 (0x0).
'Godot_v4.4-dev6_win64_console.exe' (Win32): Loaded 'C:\Windows\System32\sechost.dll'. 
'Godot_v4.4-dev6_win64_console.exe' (Win32): Loaded 'C:\Windows\System32\bcrypt.dll'. 
The thread 58360 has exited with code 3221225477 (0xc0000005).
The thread 21044 has exited with code 3221225477 (0xc0000005).
The program '[12460] Godot_v4.4-dev6_win64_console.exe' has exited with code 3221225477 (0xc0000005) 'Access violation'.
```
@GameArchitekt To get more information you'd need to build the Godot editor with `debug_symbols=yes`, not just the GDExtension.
> [@GameArchitekt](https://github.com/GameArchitekt) To get more information you'd need to build the Godot editor with `debug_symbols=yes`, not just the GDExtension.

Thanks, will give that a go to try and assist. I've been putting off building the editor as I'm only 2 months into using C++ (having spent two decades using C#).
>Can you try making your custom build with debug_symbols=yes, which should add debug symbols and produce a more useful stacktrace?

I'm not too familiar with the building systems, but I'll give it a try.

For more context, I've made the following this since I upgraded to dev6, but I don't know if any of these are responsible:
- I have changed some editor hotkeys.
  - [editor_settings-4.4.txt](https://github.com/user-attachments/files/18062155/editor_settings-4.4.txt) (change the extension to .tres)
- I have upgraded the driver of my GPU to the `Drivers NVIDIA Studio 566.14` of the GTX 1660.
  - I tried reinstalling the drivers, with no success.

I haven't changed any InputMap while in dev6.
[project.txt](https://github.com/user-attachments/files/18062142/project.txt) (change the name file back to project.godot)

The problem is happening in 4 different projects related to my main project. The project I just sent is the Gateway Server for my game. I haven't made any changes to this project since I've upgraded to dev6. The project doesn't even have a InputMap set, but if I press any key, the project crashes.
Well that went a lot smoother than expected (apart from a bug when using target=template_debug, removing fixed). Here's your improved debug output...

```
================================================================
CrashHandlerException: Program crashed
Engine version: Godot Engine v4.4.dev.custom_build (aa8d9b83f66488dbb2c9c918e9016ef80f821fb4)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[0] Variant::operator Object * (C:\dev\godot\core\variant\variant.cpp:2160)
[1] Variant::operator Object * (C:\dev\godot\core\variant\variant.cpp:2160)
[2] VariantTypeConstructor<Object *>::type_from_variant (C:\dev\godot\core\variant\variant_internal.h:1584)
[3] godot::Variant::operator godot::Object * (C:\dev\godot_project\gdextension\godot-cpp\src\variant\variant.cpp:443)
[4] godot::UIControlTabBar::_ready (C:\dev\godot_project\gdextension\src\ui\controls\ui_control_tab_bar.cpp:35)
[5] Node::_gdvirtual__ready_call (C:\dev\godot\scene\main\node.h:385)
[6] Node::_notification (C:\dev\godot\scene\main\node.cpp:228)
[7] Node::_notificationv (C:\dev\godot\scene\main\node.h:50)
[8] CanvasItem::_notificationv (C:\dev\godot\scene\main\canvas_item.h:45)
[9] Control::_notificationv (C:\dev\godot\scene\gui\control.h:47)
[10] Container::_notificationv (C:\dev\godot\scene\gui\container.h:37)
[11] BoxContainer::_notificationv (C:\dev\godot\scene\gui\box_container.h:37)
[12] HBoxContainer::_notificationv (C:\dev\godot\scene\gui\box_container.h:81)
[13] Object::notification (C:\dev\godot\core\object\object.cpp:878)
[14] Node::_propagate_ready (C:\dev\godot\scene\main\node.cpp:283)
[15] Node::_propagate_ready (C:\dev\godot\scene\main\node.cpp:274)
[16] Node::_propagate_ready (C:\dev\godot\scene\main\node.cpp:274)
[17] Node::_propagate_ready (C:\dev\godot\scene\main\node.cpp:274)
[18] Node::_propagate_ready (C:\dev\godot\scene\main\node.cpp:274)
[19] Node::_propagate_ready (C:\dev\godot\scene\main\node.cpp:274)
[20] Node::_propagate_ready (C:\dev\godot\scene\main\node.cpp:274)
[21] Node::_propagate_ready (C:\dev\godot\scene\main\node.cpp:274)
[22] Node::_propagate_ready (C:\dev\godot\scene\main\node.cpp:274)
[23] Node::_propagate_ready (C:\dev\godot\scene\main\node.cpp:274)
[24] Node::_set_tree (C:\dev\godot\scene\main\node.cpp:3262)
[25] SceneTree::initialize (C:\dev\godot\scene\main\scene_tree.cpp:481)
[26] OS_Windows::run (C:\dev\godot\platform\windows\os_windows.cpp:1997)
[27] widechar_main (C:\dev\godot\platform\windows\godot_windows.cpp:181)
[28] _main (C:\dev\godot\platform\windows\godot_windows.cpp:206)
[29] main (C:\dev\godot\platform\windows\godot_windows.cpp:220)
[30] WinMain (C:\dev\godot\platform\windows\godot_windows.cpp:234)
[31] __scrt_common_main_seh (D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288)
[32] <couldn't map PC to fn name>
-- END OF BACKTRACE --
================================================================
```
How do I know which commit represents the 4.4-dev6, to make a build with debug symbols?
It's [1f47e4c4e3a09a422e96880a7918d986dd575a63], you can find it on the release blog near the bottom
In my instance this looks more like bugs in my code not checking for nullptr or indexes outside array size rather than in Godot.
Trace of 4.4-dev6, using debug symbols.

```
================================================================
CrashHandlerException: Program crashed
Engine version: Godot Engine v4.4.dev.custom_build (1f47e4c4e3a09a422e96880a7918d986dd575a63)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[0] Array::size (C:\Users\caior\Desktop\Programas\! Godot Launchers\godot_master\core\variant\array.cpp:116)
[1] Array::size (C:\Users\caior\Desktop\Programas\! Godot Launchers\godot_master\core\variant\array.cpp:116)
[2] Shortcut::matches_event (C:\Users\caior\Desktop\Programas\! Godot Launchers\godot_master\core\input\shortcut.cpp:64)
[3] SceneDebugger::_handle_input (C:\Users\caior\Desktop\Programas\! Godot Launchers\godot_master\scene\debugger\scene_debugger.cpp:99)
[4] CallableCustomStaticMethodPointer<void,Ref<InputEvent> const &,Ref<Shortcut> const &>::call (C:\Users\caior\Desktop\Programas\! Godot Launchers\godot_master\core\object\callable_method_pointer.h:251)
[5] Callable::callp (C:\Users\caior\Desktop\Programas\! Godot Launchers\godot_master\core\variant\callable.cpp:58)
[6] CallableCustomBind::call (C:\Users\caior\Desktop\Programas\! Godot Launchers\godot_master\core\variant\callable_bind.cpp:151)
[7] Callable::callp (C:\Users\caior\Desktop\Programas\! Godot Launchers\godot_master\core\variant\callable.cpp:58)
[8] Object::emit_signalp (C:\Users\caior\Desktop\Programas\! Godot Launchers\godot_master\core\object\object.cpp:1203)
[9] Node::emit_signalp (C:\Users\caior\Desktop\Programas\! Godot Launchers\godot_master\scene\main\node.cpp:3989)
[10] Window::_window_input (C:\Users\caior\Desktop\Programas\! Godot Launchers\godot_master\scene\main\window.cpp:1675)
[11] CallableCustomMethodPointer<Window,void,Ref<InputEvent> const &>::call (C:\Users\caior\Desktop\Programas\! Godot Launchers\godot_master\core\object\callable_method_pointer.h:107)
[12] Callable::callp (C:\Users\caior\Desktop\Programas\! Godot Launchers\godot_master\core\variant\callable.cpp:58)
[13] Callable::call<Ref<InputEvent> > (C:\Users\caior\Desktop\Programas\! Godot Launchers\godot_master\core\variant\variant.h:906)
[14] DisplayServerWindows::_dispatch_input_event (C:\Users\caior\Desktop\Programas\! Godot Launchers\godot_master\platform\windows\display_server_windows.cpp:3821)
[15] Input::_parse_input_event_impl (C:\Users\caior\Desktop\Programas\! Godot Launchers\godot_master\core\input\input.cpp:903)
[16] Input::flush_buffered_events (C:\Users\caior\Desktop\Programas\! Godot Launchers\godot_master\core\input\input.cpp:1184)
[17] DisplayServerWindows::process_events (C:\Users\caior\Desktop\Programas\! Godot Launchers\godot_master\platform\windows\display_server_windows.cpp:3275)
[18] OS_Windows::run (C:\Users\caior\Desktop\Programas\! Godot Launchers\godot_master\platform\windows\os_windows.cpp:1999)
[19] widechar_main (C:\Users\caior\Desktop\Programas\! Godot Launchers\godot_master\platform\windows\godot_windows.cpp:181)
[20] _main (C:\Users\caior\Desktop\Programas\! Godot Launchers\godot_master\platform\windows\godot_windows.cpp:208)
[21] main (C:\Users\caior\Desktop\Programas\! Godot Launchers\godot_master\platform\windows\godot_windows.cpp:220)
[22] __scrt_common_main_seh (D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288)
[23] <couldn't map PC to fn name>
-- END OF BACKTRACE --
================================================================
```
Can't test the MRP because of the removed certificates, so some other change to make it run would be needed to test this
here's the new MRP: [mrp.zip](https://github.com/user-attachments/files/18063570/mrp.zip)

Cannot confirm with just this MRP, running the project directly, are there any specific steps required? (I did not try the rollback to dev5 only running it and trying input) 
> Cannot confirm with just this MRP, running the project directly, are there any specific steps required? (I did not try the rollback to dev5 only running it and trying input)

The project opens normally, but if any key is pressed while the project is open, it crashes
Then something more is needed as I cannot replicate that from the MRP

Have you confirmed it happens when running the MRP? Exactly as it is packaged?
> Then something more is needed as I cannot replicate that from the MRP
> 
> Have you confirmed it happens when running the MRP? Exactly as it is packaged?

yes, right before I zipped the file I tested opening the project and if I press any keys, the project crashes. I just tested it again and it crashes as explained. I have included the .godot folder, as I thought that could be useful in this case. I'm using 4.4-dev6, the official build released in the blog. 

Using the custom build with debug symbols the crash still happened. In this case, I get the log shown in some comments above.
It's actually related to the `editor_settings-4.4.tres` file in the Roaming/Godot/ folder. Deleting this file makes the crash disappear.

Why? No ideia. Tho, as mentioned, when I upgraded from a custom 4.4-dev5 build to the 4.4-dev6, I've made some changes to some hotkeys.

My `editor_settings-4.4.tres`: [editor_settings-4.4.txt](https://github.com/user-attachments/files/18062155/editor_settings-4.4.txt) (change the extension to .tres)
Stacktrace for @caioraphael1's MRP and editor settings from https://github.com/godotengine/godot/issues/100182#issuecomment-2528560604 on Linux in the latest `master` branch:

```
#0  Array::size (this=this@entry=0x240) at core/variant/array.cpp:117
#1  0x00000000046fa99b in Shortcut::matches_event (this=this@entry=0x0, p_event=...) at core/input/shortcut.cpp:64
#2  0x0000000003a3cdfd in SceneDebugger::_handle_input (p_event=..., p_shortcut=...) at scene/debugger/scene_debugger.cpp:99
#3  0x0000000003a47b66 in call_with_variant_args_static<Ref<InputEvent> const&, Ref<Shortcut> const&, 0ul, 1ul> (r_error=..., p_args=0x7fffc9babb70, 
    p_method=0x3a3cd10 <SceneDebugger::_handle_input(Ref<InputEvent> const&, Ref<Shortcut> const&)>) at ./core/variant/binder_common.h:778
#4  call_with_variant_args_static<Ref<InputEvent> const&, Ref<Shortcut> const&> (p_argcount=2, r_error=..., p_args=0x7fffc9babb70, 
    p_method=0x3a3cd10 <SceneDebugger::_handle_input(Ref<InputEvent> const&, Ref<Shortcut> const&)>) at ./core/variant/binder_common.h:847
#5  call_with_variant_args_static<Ref<InputEvent> const&, Ref<Shortcut> const&> (r_error=..., p_argcount=<optimized out>, p_args=0x7fffc9babb70, 
    p_method=0x3a3cd10 <SceneDebugger::_handle_input(Ref<InputEvent> const&, Ref<Shortcut> const&)>) at ./core/variant/binder_common.h:833
#6  CallableCustomStaticMethodPointer<void, Ref<InputEvent> const&, Ref<Shortcut> const&>::call (this=<optimized out>, p_arguments=0x7fffc9babb70, p_argcount=<optimized out>, r_return_value=..., 
    r_call_error=...) at ./core/object/callable_method_pointer.h:251
#7  0x00000000047113c4 in CallableCustomBind::call (this=0x496520e0, p_arguments=<optimized out>, p_argcount=1, r_return_value=..., r_call_error=...) at core/variant/callable_bind.cpp:150
#8  0x0000000004a07f3c in Object::emit_signalp (this=<optimized out>, p_name=..., p_args=0x7fffc9babd10, p_argcount=1) at core/object/object.cpp:1200
#9  0x0000000002a8acca in Object::emit_signal<Ref<InputEvent> > (p_name=..., this=0x495ac910) at ./core/object/object.h:918
#10 Window::_window_input (this=0x495ac910, p_ev=...) at scene/main/window.cpp:1675
#11 0x0000000002aa69e4 in call_with_variant_args_helper<Window, Ref<InputEvent> const&, 0ul> (r_error=..., p_args=<optimized out>, p_method=<optimized out>, p_instance=<optimized out>)
    at ./core/variant/binder_common.h:304
#12 call_with_variant_args<Window, Ref<InputEvent> const&> (r_error=..., p_argcount=<optimized out>, p_args=<optimized out>, p_method=<optimized out>, p_instance=<optimized out>)
    at ./core/variant/binder_common.h:418
#13 CallableCustomMethodPointer<Window, void, Ref<InputEvent> const&>::call (this=<optimized out>, p_arguments=<optimized out>, p_argcount=<optimized out>, r_return_value=..., r_call_error=...)
    at ./core/object/callable_method_pointer.h:107
#14 0x000000000046b555 in Callable::call<Ref<InputEvent> > (this=this@entry=0x7fffc9babe70) at ./core/variant/variant.h:905
#15 0x000000000047cdf2 in DisplayServerX11::_dispatch_input_event (this=0x47c51c90, p_event=...) at platform/linuxbsd/x11/display_server_x11.cpp:4080
#16 0x00000000046a5c66 in Input::_parse_input_event_impl (this=<optimized out>, p_event=..., p_is_emulated=<optimized out>) at core/input/input.cpp:902
#17 0x00000000046a892f in Input::flush_buffered_events (this=0x47b45ff0) at core/input/input.cpp:1183
#18 0x0000000000483c43 in DisplayServerX11::process_events (this=0x47c51c90) at platform/linuxbsd/x11/display_server_x11.cpp:5216
#19 0x0000000000454a50 in OS_LinuxBSD::run (this=this@entry=0x7fffc9bac1d0) at platform/linuxbsd/os_linuxbsd.cpp:958
#20 0x0000000000423637 in main (argc=<optimized out>, argv=0x7fffc9bac828) at platform/linuxbsd/godot_linuxbsd.cpp:85
```

I suspect that it's a combination of #98891 which doesn't properly validate the `p_shortcut` before dereferencing it (cc @Faless) and #97707 / #99449 which likely corrupted the shortcut mappings in @caioraphael1's Editor Settings (cc @Sauermann).

I can make a quick fix for the first part (missing validation check). For the corrupted shortcuts in Editor Settings, if my hunch is correct, this was just bad luck from testing 4.4-dev4 which introduced a compat breaking change to input events, which we reverted in dev5, but with compatibility code only for Project Settings, not Editor Settings. You can fix this locally by removing/redoing the editor custom hotkeys.

Fix patch:
diff --git a/scene/debugger/scene_debugger.cpp b/scene/debugger/scene_debugger.cpp
index 993a825582c0..f369aec569ec 100644
--- a/scene/debugger/scene_debugger.cpp
+++ b/scene/debugger/scene_debugger.cpp
@@ -96,7 +96,7 @@ void SceneDebugger::deinitialize() {
 #ifdef DEBUG_ENABLED
 void SceneDebugger::_handle_input(const Ref<InputEvent> &p_event, const Ref<Shortcut> &p_shortcut) {
 	Ref<InputEventKey> k = p_event;
-	if (k.is_valid() && k->is_pressed() && !k->is_echo() && p_shortcut->matches_event(k)) {
+	if (p_shortcut.is_valid() && k.is_valid() && k->is_pressed() && !k->is_echo() && p_shortcut->matches_event(k)) {
 		EngineDebugger::get_singleton()->send_message("request_quit", Array());
 	}
 }


Test patch: