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 CodeEdit functions crashes Godot #73202

Closed
qarmin opened this issue Feb 13, 2023 · 1 comment · Fixed by #86978
Closed

Executing CodeEdit functions crashes Godot #73202

qarmin opened this issue Feb 13, 2023 · 1 comment · Fixed by #86978

Comments

@qarmin
Copy link
Contributor

qarmin commented Feb 13, 2023

Godot version

4.0.beta.custom_build. a4c2d8d

System information

Ubuntu 22.10 - AMD RX 470, Gnome shell 43 X11

Issue description

When executing

 extends Node
func _process(delta):

	var temp_variable382 = CodeEdit.new()
	add_child(temp_variable382)
	temp_variable382.set_highlight_matching_braces_enabled(true)
	temp_variable382.begin_complex_operation()
	temp_variable382.do_indent()
	temp_variable382.do_indent()
	temp_variable382.unindent_lines()
	temp_variable382.undo()
	temp_variable382.queue_free()

Godot crashes:

 Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] ./godot.linuxbsd.editor.dev.x86_64.san(+0x3aae9adc) [0x55b4d2828adc] (/home/runner/work/Qarminer/Qarminer/godot/platform/linuxbsd/crash_handler_linuxbsd.cpp:57)
[2] /lib/x86_64-linux-gnu/libc.so.6(+0x42520) [0x7f98667c4520] (??:0)
[3] CowData<char32_t>::get(int) const (/home/runner/work/Qarminer/Qarminer/godot/./core/templates/cowdata.h:155 (discriminator 7))
[4] String::operator[](int) const (/home/runner/work/Qarminer/Qarminer/godot/./core/string/ustring.h:224)
[5] TextEdit::_notification(int) (/home/runner/work/Qarminer/Qarminer/godot/scene/gui/text_edit.cpp:616 (discriminator 3))
[6] TextEdit::_notificationv(int, bool) (/home/runner/work/Qarminer/Qarminer/godot/./scene/gui/text_edit.h:42 (discriminator 14))
[7] CodeEdit::_notificationv(int, bool) (/home/runner/work/Qarminer/Qarminer/godot/scene/gui/code_edit.h:37 (discriminator 3))
[8] Object::notification(int, bool) (/home/runner/work/Qarminer/Qarminer/godot/core/object/object.cpp:792)
[9] CanvasItem::_redraw_callback() (/home/runner/work/Qarminer/Qarminer/godot/scene/main/canvas_item.cpp:136)
[10] void call_with_variant_args_helper<CanvasItem>(CanvasItem*, void (CanvasItem::*)(), Variant const**, Callable::CallError&, IndexSequence<>) (/home/runner/work/Qarminer/Qarminer/godot/./core/variant/binder_common.h:298 (discriminator 4))
[11] void call_with_variant_args<CanvasItem>(CanvasItem*, void (CanvasItem::*)(), Variant const**, int, Callable::CallError&) (/home/runner/work/Qarminer/Qarminer/godot/./core/variant/binder_common.h:393)
[12] CallableCustomMethodPointer<CanvasItem>::call(Variant const**, int, Variant&, Callable::CallError&) const (/home/runner/work/Qarminer/Qarminer/godot/./core/object/callable_method_pointer.h:105)
[13] Callable::callp(Variant const**, int, Variant&, Callable::CallError&) const (/home/runner/work/Qarminer/Qarminer/godot/core/variant/callable.cpp:64)
[14] MessageQueue::_call_function(Callable const&, Variant const*, int, bool) (/home/runner/work/Qarminer/Qarminer/godot/core/object/message_queue.cpp:230)
[15] MessageQueue::flush() (/home/runner/work/Qarminer/Qarminer/godot/core/object/message_queue.cpp:277)
[16] SceneTree::process(double) (/home/runner/work/Qarminer/Qarminer/godot/scene/main/scene_tree.cpp:470 (discriminator 4))
[17] Main::iteration() (/home/runner/work/Qarminer/Qarminer/godot/main/main.cpp:3159)
[18] OS_LinuxBSD::run() (/home/runner/work/Qarminer/Qarminer/godot/platform/linuxbsd/os_linuxbsd.cpp:880)
[19] ./godot.linuxbsd.editor.dev.x86_64.san(main+0x58f) [0x55b4d2828488] (/home/runner/work/Qarminer/Qarminer/godot/platform/linuxbsd/godot_linuxbsd.cpp:75)
[20] /lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x7f98667abd90] (??:0)
[21] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80) [0x7f98667abe40] (??:0)
[22] ./godot.linuxbsd.editor.dev.x86_64.san(_start+0x25) [0x55b4d2827e35] (??:?)

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

N/A

@qarmin qarmin changed the title 4.0.beta.custom_build. a4c2d8dc7 Executing CodeEdit functions crashes Godot Feb 13, 2023
@MewPurPur
Copy link
Contributor

MewPurPur commented Feb 18, 2023

Complex operations must be ended before doing UndoRedo, so the crash might be related to this. queue_free() shouldn't have anything to do with the crash.

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