Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Executing EditorInterface.restart_editor function crashes Godot #80704

Closed
qarmin opened this issue Aug 17, 2023 · 1 comment · Fixed by #80962
Closed

Executing EditorInterface.restart_editor function crashes Godot #80704

qarmin opened this issue Aug 17, 2023 · 1 comment · Fixed by #80962

Comments

@qarmin
Copy link
Contributor

qarmin commented Aug 17, 2023

Godot version

4.2.dev.custom_build. a278c1b

System information

Ubuntu 22.04 CI

Issue description

When executing

extends Node2D
func _process(delta):

	var temp_variable_f120 = true
	EditorInterface.restart_editor(temp_variable_f120)

Godot crashes:

editor/editor_interface.cpp:53:47: runtime error: member call on null pointer of type 'struct EditorNode'
editor/editor_interface.cpp:53:47: runtime error: member access within null pointer of type 'struct EditorNode'

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.2.dev.custom_build (a278c1b98a81738a35b96a933a6e6cf771f9ab2d)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /home/rafal/Downloads/Untitled Folder/godot.linuxbsd.editor.dev.x86_64.san() [0x2ab1482] (/home/runner/work/GodotBuilds/GodotBuilds/godot/platform/linuxbsd/crash_handler_linuxbsd.cpp:57)
[2] /lib/x86_64-linux-gnu/libc.so.6(+0x3c4b0) [0x7f4f73c3c4b0] (??:0)
[3] EditorInterface::restart_editor(bool) (/home/runner/work/GodotBuilds/GodotBuilds/godot/editor/editor_interface.cpp:53)
[4] void call_with_variant_args_helper<__UnexistingClass, bool, 0ul>(__UnexistingClass*, void (__UnexistingClass::*)(bool), Variant const**, Callable::CallError&, IndexSequence<0ul>) (/home/runner/work/GodotBuilds/GodotBuilds/godot/./core/variant/binder_common.h:308 (discriminator 4))
[5] void call_with_variant_args_dv<__UnexistingClass, bool>(__UnexistingClass*, void (__UnexistingClass::*)(bool), Variant const**, int, Callable::CallError&, Vector<Variant> const&) (/home/runner/work/GodotBuilds/GodotBuilds/godot/./core/variant/binder_common.h:421)
[6] MethodBindT<bool>::call(Object*, Variant const**, int, Callable::CallError&) const (/home/runner/work/GodotBuilds/GodotBuilds/godot/./core/object/method_bind.h:331)
[7] GDScriptFunction::call(GDScriptInstance*, Variant const**, int, Callable::CallError&, GDScriptFunction::CallState*) (/home/runner/work/GodotBuilds/GodotBuilds/godot/modules/gdscript/gdscript_vm.cpp:1825)
[8] GDScriptInstance::callp(StringName const&, Variant const**, int, Callable::CallError&) (/home/runner/work/GodotBuilds/GodotBuilds/godot/modules/gdscript/gdscript.cpp:1892)
[9] bool Node::_gdvirtual__process_call<false>(double) (/home/runner/work/GodotBuilds/GodotBuilds/godot/scene/main/node.h:318 (discriminator 1))
[10] Node::_notification(int) (/home/runner/work/GodotBuilds/GodotBuilds/godot/scene/main/node.cpp:57)
[11] Node::_notificationv(int, bool) (/home/runner/work/GodotBuilds/GodotBuilds/godot/./scene/main/node.h:49 (discriminator 14))
[12] CanvasItem::_notificationv(int, bool) (/home/runner/work/GodotBuilds/GodotBuilds/godot/./scene/main/canvas_item.h:45 (discriminator 3))
[13] Node2D::_notificationv(int, bool) (/home/runner/work/GodotBuilds/GodotBuilds/godot/./scene/2d/node_2d.h:37 (discriminator 3))
[14] Object::notification(int, bool) (/home/runner/work/GodotBuilds/GodotBuilds/godot/core/object/object.cpp:800)
[15] SceneTree::_process_group(SceneTree::ProcessGroup*, bool) (/home/runner/work/GodotBuilds/GodotBuilds/godot/scene/main/scene_tree.cpp:948)
[16] SceneTree::_process(bool) (/home/runner/work/GodotBuilds/GodotBuilds/godot/scene/main/scene_tree.cpp:1020 (discriminator 2))
[17] SceneTree::process(double) (/home/runner/work/GodotBuilds/GodotBuilds/godot/scene/main/scene_tree.cpp:510)
[18] Main::iteration() (/home/runner/work/GodotBuilds/GodotBuilds/godot/main/main.cpp:3467)
[19] OS_LinuxBSD::run() (/home/runner/work/GodotBuilds/GodotBuilds/godot/platform/linuxbsd/os_linuxbsd.cpp:912)
[20] /home/rafal/Downloads/Untitled Folder/godot.linuxbsd.editor.dev.x86_64.san(main+0x58f) [0x2ab0f15] (/home/runner/work/GodotBuilds/GodotBuilds/godot/platform/linuxbsd/godot_linuxbsd.cpp:76)
[21] /lib/x86_64-linux-gnu/libc.so.6(+0x23a90) [0x7f4f73c23a90] (??:0)
[22] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x89) [0x7f4f73c23b49] (??:0)
[23] /home/rafal/Downloads/Untitled Folder/godot.linuxbsd.editor.dev.x86_64.san(_start+0x25) [0x2ab08c5] (??:?)
-- END OF BACKTRACE --

This example was found by Godot fuzzer - Qarminer, so it is quite unlikelly that this code could be used in real project, but still this should be handled gracefully.

Memory leaks or asan backtraces are visibe when using Godot build with sanitizers support - https://github.com/qarmin/GodotBuilds/actions (linux -> linux-editor-sanitizers)

Steps to reproduce

Above

Minimal reproduction project

Above

@jsjtxietian
Copy link
Contributor

Same crash with silently different backtrace
Godot v4.2.dev (7ba79d6) - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3060 (NVIDIA; 31.0.15.3118) - 11th Gen Intel(R) Core(TM) i7-11700K @ 3.60GHz (16 Threads)

================================================================
CrashHandlerException: Program crashed
Engine version: Godot Engine v4.2.dev.custom_build (7ba79d68bd0f97797d7cb37452da6a036ba7c7c9)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[0] EditorNode::save_all_scenes (D:\Code\godot\editor\editor_node.cpp:1834)
[1] EditorNode::save_all_scenes (D:\Code\godot\editor\editor_node.cpp:1834)
[2] EditorInterface::restart_editor (D:\Code\godot\editor\editor_interface.cpp:55)
[3] call_with_variant_args_helper<EditorInterface,bool,0> (D:\Code\godot\core\variant\binder_common.h:308)
[4] call_with_variant_args_dv<EditorInterface,bool> (D:\Code\godot\core\variant\binder_common.h:451)
[5] MethodBindT<EditorInterface,bool>::call (D:\Code\godot\core\object\method_bind.h:333)
[6] GDScriptFunction::call (D:\Code\godot\modules\gdscript\gdscript_vm.cpp:1825)
[7] GDScriptInstance::callp (D:\Code\godot\modules\gdscript\gdscript.cpp:1892)
[8] Node::_gdvirtual__ready_call<0> (D:\Code\godot\scene\main\node.h:322)
[9] Node::_notification (D:\Code\godot\scene\main\node.cpp:187)
[10] Node::_notificationv (D:\Code\godot\scene\main\node.h:49)
[11] CanvasItem::_notificationv (D:\Code\godot\scene\main\canvas_item.h:45)
[12] Node2D::_notificationv (D:\Code\godot\scene\2d\node_2d.h:37)
[13] Sprite2D::_notificationv (D:\Code\godot\scene\2d\sprite_2d.h:38)
[14] Object::notification (D:\Code\godot\core\object\object.cpp:800)
[15] Node::_propagate_ready (D:\Code\godot\scene\main\node.cpp:231)
[16] Node::_propagate_ready (D:\Code\godot\scene\main\node.cpp:222)
[17] Node::_propagate_ready (D:\Code\godot\scene\main\node.cpp:222)
[18] Node::_set_tree (D:\Code\godot\scene\main\node.cpp:2912)
[19] SceneTree::initialize (D:\Code\godot\scene\main\scene_tree.cpp:450)
[20] OS_Windows::run (D:\Code\godot\platform\windows\os_windows.cpp:1477)
[21] widechar_main (D:\Code\godot\platform\windows\godot_windows.cpp:182)
[22] _main (D:\Code\godot\platform\windows\godot_windows.cpp:204)
[23] main (D:\Code\godot\platform\windows\godot_windows.cpp:218)
[24] WinMain (D:\Code\godot\platform\windows\godot_windows.cpp:232)
[25] __scrt_common_main_seh (D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288)
[26] <couldn't map PC to fn name>
-- END OF BACKTRACE --
================================================================

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants