Godot version:
310c755a
OS/device including version:
4.20.10-arch1-1-ARCH
Issue description:
When moving a bunch of files from a folder to another folder, the editor crashed with the following backtrace:
handle_crash: Program crashed with signal 11
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /usr/lib/libc.so.6(+0x37e00) [0x7f23f254fe00] (??:0)
[2] /usr/lib/libstdc++.so.6(__dynamic_cast+0x24) [0x7f23f290b694] (??:0)
[3] Spatial* Object::cast_to<Spatial>(Object*) (godot/./core/object.h:587)
[4] SpatialEditor::_request_gizmo(Object*) (godot/editor/plugins/spatial_editor_plugin.cpp:5202)
[5] MethodBind1<SpatialEditor, Object*>::call(Object*, Variant const**, int, Variant::CallError&) (godot/./core/method_bind.gen.inc:815)
[6] Object::call(StringName const&, Variant const**, int, Variant::CallError&) (godot/core/object.cpp:945)
[7] MessageQueue::_call_function(Object*, StringName const&, Variant const*, int, bool) (godot/core/message_queue.cpp:256)
[8] MessageQueue::flush() (godot/core/message_queue.cpp:305)
[9] SceneTree::iteration(float) (godot/scene/main/scene_tree.cpp:477)
[10] Main::iteration() (godot/main/main.cpp:1869)
[11] OS_X11::run() (godot/platform/x11/os_x11.cpp:2975)
[12] ./godot.x11.tools.64.llvm(main+0x151) [0x15415e1] (godot/platform/x11/godot_x11.cpp:55)
[13] /usr/lib/libc.so.6(__libc_start_main+0xf3) [0x7f23f253c223] (??:0)
[14] ./godot.x11.tools.64.llvm(_start+0x2e) [0x15413ce] (??:)
-- END OF BACKTRACE --
Note about what I was moving:
I was moving files from a folder to a sub folders.
The files were related in the following way:
A.tscn is including A.escn and A.gd
B.tscn is including B.escn and B.gd
Steps to reproduce:
See Jfons first comment :)
Seems related to Spatial gizmos @JFonS.
I can reproduce the error and I got it to crash in other parts of the engine, so it looks like memory corruption to me. I'm not sure how to properly debug this, but I have a MRP:
dirA in the file system dockdirA to dirBI could reproduce the bug with a different backtrace from @QbieShay's, on 8f5d9b639:
ERROR: _get_modified_time: Failed to get modified time for: res://dirA/b.escn
At: drivers/unix/file_access_unix.cpp:292.
ERROR: _load: No loader found for resource: res://dirA/b.escn
At: core/io/resource_loader.cpp:285.
handle_crash: Program crashed with signal 11
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /lib64/libc.so.6() [0x388d43cc00] (??:0)
[2] Node::get_node_or_null(NodePath const&) const (/home/akien/Projects/godot/godot.git/scene/main/node.cpp:1316)
[3] SceneState::instance(SceneState::GenEditState) const (/home/akien/Projects/godot/godot.git/scene/resources/packed_scene.cpp:97 (discriminator 4))
[4] PackedScene::instance(PackedScene::GenEditState) const (/home/akien/Projects/godot/godot.git/scene/resources/packed_scene.cpp:1699)
[5] EditorData::check_and_update_scene(int) (/home/akien/Projects/godot/godot.git/editor/editor_data.cpp:642 (discriminator 5))
[6] EditorNode::set_current_scene(int) (/home/akien/Projects/godot/godot.git/editor/editor_node.cpp:2888)
[7] MethodBind1<int>::call(Object*, Variant const**, int, Variant::CallError&) (/home/akien/Projects/godot/godot.git/./core/method_bind.gen.inc:729 (discriminator 12))
[8] Object::call(StringName const&, Variant const**, int, Variant::CallError&) (/home/akien/Projects/godot/godot.git/core/object.cpp:942 (discriminator 1))
[9] UndoRedo::_process_operation_list(List<UndoRedo::Operation, DefaultAllocator>::Element*) (/home/akien/Projects/godot/godot.git/core/undo_redo.cpp:289 (discriminator 4))
[10] UndoRedo::redo() (/home/akien/Projects/godot/godot.git/core/undo_redo.cpp:333)
[11] UndoRedo::commit_action() (/home/akien/Projects/godot/godot.git/core/undo_redo.cpp:255)
[12] EditorNode::_scene_tab_changed(int) (/home/akien/Projects/godot/godot.git/editor/editor_node.cpp:4199 (discriminator 4))
[13] EditorNode::reload_scene(String const&) (/home/akien/Projects/godot/godot.git/editor/editor_node.cpp:4607)
[14] FileSystemDock::_update_dependencies_after_move(Map<String, String, Comparator<String>, DefaultAllocator> const&) const (/home/akien/Projects/godot/godot.git/editor/filesystem_dock.cpp:1111)
[15] FileSystemDock::_move_operation_confirm(String const&, bool) (/home/akien/Projects/godot/godot.git/editor/filesystem_dock.cpp:1337)
[16] FileSystemDock::drop_data_fw(Vector2 const&, Variant const&, Control*) (/home/akien/Projects/godot/godot.git/editor/filesystem_dock.cpp:1893)
[17] MethodBind3<Vector2 const&, Variant const&, Control*>::call(Object*, Variant const**, int, Variant::CallError&) (/home/akien/Projects/godot/godot.git/./core/method_bind.gen.inc:2151 (discriminator 26))
[18] Object::call(StringName const&, Variant const**, int, Variant::CallError&) (/home/akien/Projects/godot/godot.git/core/object.cpp:942 (discriminator 1))
[19] Object::call(StringName const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&) (/home/akien/Projects/godot/godot.git/core/object.cpp:867)
[20] Control::drop_data(Vector2 const&, Variant const&) (/home/akien/Projects/godot/godot.git/scene/gui/control.cpp:750 (discriminator 6))
[21] Viewport::_gui_drop(Control*, Vector2, bool) (/home/akien/Projects/godot/godot.git/scene/main/viewport.cpp:1685)
[22] Viewport::_gui_input_event(Ref<InputEvent>) (/home/akien/Projects/godot/godot.git/scene/main/viewport.cpp:1866)
[23] Viewport::input(Ref<InputEvent> const&) (/home/akien/Projects/godot/godot.git/scene/main/viewport.cpp:2653 (discriminator 2))
[24] Viewport::_vp_input(Ref<InputEvent> const&) (/home/akien/Projects/godot/godot.git/scene/main/viewport.cpp:1304)
[25] MethodBind1<Ref<InputEvent> const&>::call(Object*, Variant const**, int, Variant::CallError&) (/home/akien/Projects/godot/godot.git/./core/method_bind.gen.inc:729 (discriminator 12))
[26] Object::call(StringName const&, Variant const**, int, Variant::CallError&) (/home/akien/Projects/godot/godot.git/core/object.cpp:942 (discriminator 1))
[27] Object::call(StringName const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&) (/home/akien/Projects/godot/godot.git/core/object.cpp:867)
[28] SceneTree::call_group_flags(unsigned int, StringName const&, StringName const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&) (/home/akien/Projects/godot/godot.git/scene/main/scene_tree.cpp:262)
[29] SceneTree::input_event(Ref<InputEvent> const&) (/home/akien/Projects/godot/godot.git/scene/main/scene_tree.cpp:418 (discriminator 6))
[30] InputDefault::_parse_input_event_impl(Ref<InputEvent> const&, bool) (/home/akien/Projects/godot/godot.git/main/input_default.cpp:416)
[31] InputDefault::parse_input_event(Ref<InputEvent> const&) (/home/akien/Projects/godot/godot.git/main/input_default.cpp:260)
[32] InputDefault::flush_accumulated_events() (/home/akien/Projects/godot/godot.git/main/input_default.cpp:680)
[33] OS_X11::process_xevents() (/home/akien/Projects/godot/godot.git/platform/x11/os_x11.cpp:2462)
[34] OS_X11::run() (/home/akien/Projects/godot/godot.git/platform/x11/os_x11.cpp:3004)
[35] godot-git(main+0xbb) [0x11be92d] (/home/akien/Projects/godot/godot.git/platform/x11/godot_x11.cpp:56)
[36] /lib64/libc.so.6(__libc_start_main+0xeb) [0x388d426b0b] (??:0)
[37] godot-git(_start+0x2a) [0x11be7ca] (/home/iurt/rpmbuild/BUILD/glibc-2.29/csu/../sysdeps/x86_64/start.S:122
The crash in the original backtrace should be fixed by 06dbeab, so I'll compile and try again.
Still crashes with my backtrace above with e28e84901.
I've had crashes when moving files around as well and just made a minimal reproduction project.
I think it differs a little from what's been done here so far, so here you go:
crash-on-moving-files.zip
Steps to reproduce:
It does not appear to crash if I only move image.png, since it is not used by the BNnode2D.tscn, which is open by default.
The crash does not seem to appear if both ANode2D and BNode2D are open, only if ANode2D is not open and BNode2D is.
Both images are being used by ANode2D.tscn.
EDIT: I'm using Godot 3.1 RC1
What @Byteron reported is another problem entirely :( #26910 'fixes' that one and not the escn one
should I open a separate issue then?
I don't think so, as there's a fix incoming.
Related/possible duplicates: #22230 #28012
Error from Valgring
Invalid read of size 8
at 0x6370CD2: __dynamic_cast (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.26)
by 0x182A9FA: Spatial* Object::cast_to<Spatial>(Object*) (object.h:589)
by 0x2521077: SpatialEditor::_request_gizmo(Object*) (spatial_editor_plugin.cpp:5338)
by 0x142FBEA: MethodBind1<Object*>::call(Object*, Variant const**, int, Variant::CallError&) (method_bind.gen.inc:775)
by 0x3660234: Object::call(StringName const&, Variant const**, int, Variant::CallError&) (object.cpp:940)
by 0x3657085: MessageQueue::_call_function(Object*, StringName const&, Variant const*, int, bool) (message_queue.cpp:256)
by 0x3657337: MessageQueue::flush() (message_queue.cpp:303)
by 0x28E6600: SceneTree::iteration(float) (scene_tree.cpp:480)
by 0x13BB04D: Main::iteration() (main.cpp:1892)
by 0x138CBC0: OS_X11::run() (os_x11.cpp:3034)
by 0x137D98D: main (godot_x11.cpp:55)
Address 0x1bbb5830 is 16 bytes inside a block of size 768 free'd
at 0x581397B: free (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
by 0x379A64C: Memory::free_static(void*, bool) (memory.cpp:181)
by 0x15F13CE: void memdelete<Node>(Node*) (memory.h:122)
by 0x1F260E7: EditorData::remove_scene(int) (editor_data.cpp:571)
by 0x1FFF7F4: EditorNode::_remove_edited_scene() (editor_node.cpp:2886)
by 0x1FFF8C6: EditorNode::_remove_scene(int) (editor_node.cpp:2896)
by 0x1FFC3E5: EditorNode::_discard_changes(String const&) (editor_node.cpp:2588)
by 0x200A27B: EditorNode::_scene_tab_closed(int, int) (editor_node.cpp:4257)
by 0x200A6ED: EditorNode::_scene_tab_input(Ref<InputEvent> const&) (editor_node.cpp:4291)
by 0x160424D: MethodBind1<Ref<InputEvent> const&>::call(Object*, Variant const**, int, Variant::CallError&) (method_bind.gen.inc:775)
by 0x3660234: Object::call(StringName const&, Variant const**, int, Variant::CallError&) (object.cpp:940)
by 0x3661F50: Object::emit_signal(StringName const&, Variant const**, int) (object.cpp:1240)
Block was alloc'd at
at 0x581274F: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
by 0x379A263: Memory::alloc_static(unsigned long, bool) (memory.cpp:85)
by 0x379A20C: operator new(unsigned long, char const*) (memory.cpp:42)
by 0x28989FB: Object* ClassDB::creator<Spatial>() (class_db.h:146)
by 0x35DC923: ClassDB::instance(StringName const&) (class_db.cpp:540)
by 0x3067CE7: SceneState::instance(SceneState::GenEditState) const (packed_scene.cpp:155)
by 0x307308A: PackedScene::instance(PackedScene::GenEditState) const (packed_scene.cpp:1699)
by 0x200180A: EditorNode::load_scene(String const&, bool, bool, bool, bool) (editor_node.cpp:3169)
by 0x2002023: EditorNode::open_request(String const&) (editor_node.cpp:3224)
by 0x211D4D9: FileSystemDock::_select_file(String, bool) (filesystem_dock.cpp:821)
by 0x211D7E6: FileSystemDock::_tree_activate_file() (filesystem_dock.cpp:840)
by 0x14219F4: MethodBind0::call(Object*, Variant const**, int, Variant::CallError&) (method_bind.gen.inc:59)
Sadly with 3.2.dev.custom_build. 197b65f32 I still got a crash
[1] /lib/x86_64-linux-gnu/libc.so.6(+0x43f60) [0x7f9a5c9caf60] (??:0)
[2] /lib/x86_64-linux-gnu/libstdc++.so.6(__dynamic_cast+0x20) [0x7f9a5cd7dde0] (??:0)
[3] Spatial* Object::cast_to<Spatial>(Object*) (/home/rafal/Pulpit/godot/./core/object.h:589 (discriminator 1))
[4] SpatialEditor::_request_gizmo(Object*) (/home/rafal/Pulpit/godot/editor/plugins/spatial_editor_plugin.cpp:5338)
[5] MethodBind1<Object*>::call(Object*, Variant const**, int, Variant::CallError&) (/home/rafal/Pulpit/godot/./core/method_bind.gen.inc:775 (discriminator 12))
[6] Object::call(StringName const&, Variant const**, int, Variant::CallError&) (/home/rafal/Pulpit/godot/core/object.cpp:940 (discriminator 1))
[7] MessageQueue::_call_function(Object*, StringName const&, Variant const*, int, bool) (/home/rafal/Pulpit/godot/core/message_queue.cpp:256)
[8] MessageQueue::flush() (/home/rafal/Pulpit/godot/core/message_queue.cpp:305)
[9] SceneTree::iteration(float) (/home/rafal/Pulpit/godot/scene/main/scene_tree.cpp:481 (discriminator 2))
[10] Main::iteration() (/home/rafal/Pulpit/godot/main/main.cpp:1896)
[11] OS_X11::run() (/home/rafal/Pulpit/godot/platform/x11/os_x11.cpp:3034)
[12] /usr/bin/godot(main+0xdc) [0x138598e] (/home/rafal/Pulpit/godot/platform/x11/godot_x11.cpp:56)
[13] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xeb) [0x7f9a5c9adb6b] (??:0)
[14] /usr/bin/godot(_start+0x2a) [0x13857fa] (??:?)
Steps to reproduce:
This bugreport is actually two separate bugs. The last reported one (crash in SpatialEditor::_request_gizmo) has nothing really to do with moving files. I have a fix for this also but I removed it from the other PR. I'll make a new PR for this particular issue.
I could reproduce the bug with a different backtrace from @QbieShay's, on 8f5d9b6:
ERROR: _get_modified_time: Failed to get modified time for: res://dirA/b.escn At: drivers/unix/file_access_unix.cpp:292. ERROR: _load: No loader found for resource: res://dirA/b.escn At: core/io/resource_loader.cpp:285. handle_crash: Program crashed with signal 11 Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues [1] /lib64/libc.so.6() [0x388d43cc00] (??:0) [2] Node::get_node_or_null(NodePath const&) const (/home/akien/Projects/godot/godot.git/scene/main/node.cpp:1316) [3] SceneState::instance(SceneState::GenEditState) const (/home/akien/Projects/godot/godot.git/scene/resources/packed_scene.cpp:97 (discriminator 4)) ...The crash in the original backtrace should be fixed by 06dbeab, so I'll compile and try again.
I could reproduce that, too. The problem lies inside SceneState::instance function.
In case which leads to this bug,
https://github.com/godotengine/godot/blob/871a9d5d56ead0b640618762cd945be0fb2cff97/scene/resources/packed_scene.cpp#L106
remains NULL for the first iteration of loop. Comment inside this loop insists that it's a normal situation and should be ignored:
https://github.com/godotengine/godot/blob/871a9d5d56ead0b640618762cd945be0fb2cff97/scene/resources/packed_scene.cpp#L183-L185
But if this situation occur on first loop iteration, then we have ret_nodes[0] as NULL:
https://github.com/godotengine/godot/blob/871a9d5d56ead0b640618762cd945be0fb2cff97/scene/resources/packed_scene.cpp#L297
(which is, by the way, returned by this function on completion)
And on second iteration, macro NODE_FROM_ID dereferences ret_nodes[0]:
https://github.com/godotengine/godot/blob/871a9d5d56ead0b640618762cd945be0fb2cff97/scene/resources/packed_scene.cpp#L54-L59
which leads to segmentation fault.
I'm not experienced with Godot internals much and can't say how this should be fixed. In my opinion if (i == 0 && !node), then function should just stop with fail condition.