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

Bottom Panel Plugin with SubViewport and Camera causes crash #76035

Closed
maxcaplan opened this issue Apr 13, 2023 · 5 comments · Fixed by #79645
Closed

Bottom Panel Plugin with SubViewport and Camera causes crash #76035

maxcaplan opened this issue Apr 13, 2023 · 5 comments · Fixed by #79645

Comments

@maxcaplan
Copy link

Godot version

4.0-stable

System information

Fedora Linux 37

Issue description

When a plugin adds a bottom panel to the editor with add_control_to_bottom_panel(control: Control, title: String), if the bottom panel scene contains a SubViewport with a Camera2D, the editor will crash with the following back trace:

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.0.stable.official (92bee43adba8d2401ef40e2480e53087bcb1eaf1)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /lib64/libc.so.6(+0x3cb20) [0x7f899af8fb20] (??:0)
[2] /home/max/godot/Godot_v4.0-stable_linux.x86_64() [0x312ab03] (??:0)
[3] /home/max/godot/Godot_v4.0-stable_linux.x86_64() [0x4568594] (??:0)
[4] /home/max/godot/Godot_v4.0-stable_linux.x86_64() [0x2b594c9] (??:0)
[5] /home/max/godot/Godot_v4.0-stable_linux.x86_64() [0x2b5b552] (??:0)
[6] /home/max/godot/Godot_v4.0-stable_linux.x86_64() [0x2b5b701] (??:0)
[7] /home/max/godot/Godot_v4.0-stable_linux.x86_64() [0x2b5b7eb] (??:0)
[8] /home/max/godot/Godot_v4.0-stable_linux.x86_64() [0x2b2aa46] (??:0)
[9] /home/max/godot/Godot_v4.0-stable_linux.x86_64() [0x128ca03] (??:0)
[10] /home/max/godot/Godot_v4.0-stable_linux.x86_64() [0x118b77f] (??:0)
[11] /home/max/godot/Godot_v4.0-stable_linux.x86_64() [0x458c73b] (??:0)
[12] /home/max/godot/Godot_v4.0-stable_linux.x86_64() [0x43c69a4] (??:0)
[13] /home/max/godot/Godot_v4.0-stable_linux.x86_64() [0x4b84d75] (??:0)
[14] /home/max/godot/Godot_v4.0-stable_linux.x86_64() [0x45dac77] (??:0)
[15] /home/max/godot/Godot_v4.0-stable_linux.x86_64() [0x2bd1cc8] (??:0)
[16] /home/max/godot/Godot_v4.0-stable_linux.x86_64() [0xebffb6] (??:0)
[17] /home/max/godot/Godot_v4.0-stable_linux.x86_64() [0xe027f3] (??:0)
[18] /lib64/libc.so.6(+0x27510) [0x7f899af7a510] (??:0)
[19] /lib64/libc.so.6(__libc_start_main+0x89) [0x7f899af7a5c9] (??:0)
[20] /home/max/godot/Godot_v4.0-stable_linux.x86_64() [0xe2286e] (??:0)
-- END OF BACKTRACE --
================================================================

The only time I have found this error to not occur is if you enable said plugin when the bottom panel scene is already open in the editor

Steps to reproduce

  1. Create a new plugin
  2. Create a new scene with a control node root
  3. Add a SubViewport as a child of the scene
  4. Add a Camera2D as a child of the SubViewport
  5. Use add_control_to_bottom_panel in the plugin script to add said scene to the bottom panel
  6. Have said plugin enabled when said scene is not loaded in the editor

To trigger the crash in the minimal reproduction project, make sure the bottom_panel_example.tscn scene is closed then go to Project -> Project Settings -> Plugins and click enable next to example_plugin

Minimal reproduction project

MinimalReproductionProject.zip

@limbonaut
Copy link
Contributor

limbonaut commented Apr 20, 2023

Today ran into similar issue. We use SubViewport in a plugin to render and save level image. It crashes with a similar stack trace.
Will try with a debug build of the editor to get a better trace.

EDIT:

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.1.catlantis.dev.custom_build (47dc99bd9118d4038d7115b2691954222741cc9b)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /usr/lib/libc.so.6(+0x38f50) [0x7ffff7a51f50] (??:0)
[2] Node::is_inside_tree() const (/home/narren/Src/godot/./scene/main/node.h:353)
[3] Node::_propagate_enter_tree() (/home/narren/Src/godot/scene/main/node.cpp:233)
[4] Node::_propagate_enter_tree() (/home/narren/Src/godot/scene/main/node.cpp:232)
[5] Node::_propagate_enter_tree() (/home/narren/Src/godot/scene/main/node.cpp:232)
[6] Node::_set_tree(SceneTree*) (/home/narren/Src/godot/scene/main/node.cpp:2612)
[7] Node::_add_child_nocheck(Node*, StringName const&, Node::InternalMode) (/home/narren/Src/godot/scene/main/node.cpp:?)
[8] Node::add_child(Node*, bool, Node::InternalMode) (/home/narren/Src/godot/scene/main/node.cpp:?)
[9] void call_with_variant_args_helper<__UnexistingClass, Node*, bool, Node::InternalMode, 0ul, 1ul, 2ul>(__UnexistingClass*, void (__UnexistingClass::*)(Node*, bool, Node::InternalMode), Variant const**, Callable::CallError&, IndexSequence<0ul, 1ul, 2ul>) (/home/narren/Src/godot/./core/variant/binder_common.h:298)
[10] void call_with_variant_args_dv<__UnexistingClass, Node*, bool, Node::InternalMode>(__UnexistingClass*, void (__UnexistingClass::*)(Node*, bool, Node::InternalMode), Variant const**, int, Callable::CallError&, Vector<Variant> const&) (/home/narren/Src/godot/./core/variant/binder_common.h:?)
[11] MethodBindT<Node*, bool, Node::InternalMode>::call(Object*, Variant const**, int, Callable::CallError&) const (/home/narren/Src/godot/./core/object/method_bind.h:324)
[12] GDScriptFunction::call(GDScriptInstance*, Variant const**, int, Callable::CallError&, GDScriptFunction::CallState*) (/home/narren/Src/godot/modules/gdscript/gdscript_vm.cpp:1758)
[13] GDScriptFunctionState::resume(Variant const&) (/home/narren/Src/godot/modules/gdscript/gdscript_function.cpp:252)
[14] GDScriptFunctionState::_signal_callback(Variant const**, int, Callable::CallError&) (/home/narren/Src/godot/modules/gdscript/gdscript_function.cpp:202)
[15] MethodBindVarArgTR<GDScriptFunctionState, Variant>::call(Object*, Variant const**, int, Callable::CallError&) const (/home/narren/Src/godot/./core/object/method_bind.h:254)
[16] Object::callp(StringName const&, Variant const**, int, Callable::CallError&) (/home/narren/Src/godot/core/object/object.cpp:734)
[17] Callable::callp(Variant const**, int, Variant&, Callable::CallError&) const (/home/narren/Src/godot/core/variant/callable.cpp:62)
[18] CallableCustomBind::call(Variant const**, int, Variant&, Callable::CallError&) const (/home/narren/Src/godot/core/variant/callable_bind.cpp:144)
[19] Callable::callp(Variant const**, int, Variant&, Callable::CallError&) const (/home/narren/Src/godot/core/variant/callable.cpp:51)
[20] Object::emit_signalp(StringName const&, Variant const**, int) (/home/narren/Src/godot/core/object/object.cpp:1047)
[21] Error Object::emit_signal<>(StringName const&) (/home/narren/Src/godot/./core/object/object.h:869)
[22] RenderingServerDefault::_draw(bool, double) (/home/narren/Src/godot/servers/rendering/rendering_server_default.cpp:122)
[23] RenderingServerDefault::draw(bool, double) (/home/narren/Src/godot/servers/rendering/rendering_server_default.cpp:397)
[24] Main::iteration() (/home/narren/Src/godot/main/main.cpp:3187)
[25] OS_LinuxBSD::run() (/home/narren/Src/godot/platform/linuxbsd/os_linuxbsd.cpp:889)
[26] /home/narren/Src/godot/bin/godot.linuxbsd.editor.dev.x86_64.llvm(main+0x22b) [0x55555a1252ab] (/home/narren/Src/godot/platform/linuxbsd/godot_linuxbsd.cpp:73)
[27] /usr/lib/libc.so.6(+0x23790) [0x7ffff7a3c790] (??:0)
[28] /usr/lib/libc.so.6(__libc_start_main+0x8a) [0x7ffff7a3c84a] (??:0)
[29] /home/narren/Src/godot/bin/godot.linuxbsd.editor.dev.x86_64.llvm(_start+0x25) [0x55555a124fa5] (??:?)
-- END OF BACKTRACE --
================================================================

@limbonaut
Copy link
Contributor

limbonaut commented Apr 20, 2023

Here is a stack trace for the reproduction project using Godot 4.1.dev(db13026) on Manjaro Gnome:

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.1.dev.custom_build (db1302637023168f7becceb1c4ce13228e1b2a43)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /usr/lib/libc.so.6(+0x38f50) [0x7ffff7a51f50] (??:0)
[2] Node::get_viewport() const (/home/narren/Src/godot/./scene/main/node.h:528)
[3] Camera2D::_update_scroll() (/home/narren/Src/godot/scene/2d/camera_2d.cpp:44)
[4] Camera2D::_notification(int) (/home/narren/Src/godot/scene/2d/camera_2d.cpp:260)
[5] Camera2D::_notificationv(int, bool) (/home/narren/Src/godot/scene/2d/camera_2d.h:37)
[6] Object::notification(int, bool) (/home/narren/Src/godot/core/object/object.cpp:791)
[7] Node::_propagate_enter_tree() (/home/narren/Src/godot/scene/main/node.cpp:215)
[8] Node::_propagate_enter_tree() (/home/narren/Src/godot/scene/main/node.cpp:232)
[9] Node::_propagate_enter_tree() (/home/narren/Src/godot/scene/main/node.cpp:232)
[10] Node::_set_tree(SceneTree*) (/home/narren/Src/godot/scene/main/node.cpp:2623)
[11] Node::_add_child_nocheck(Node*, StringName const&, Node::InternalMode) (/home/narren/Src/godot/scene/main/node.cpp:?)
[12] Node::add_child(Node*, bool, Node::InternalMode) (/home/narren/Src/godot/scene/main/node.cpp:?)
[13] EditorNode::add_bottom_panel_item(String, Control*) (/home/narren/Src/godot/editor/editor_node.cpp:5599)
[14] EditorPlugin::add_control_to_bottom_panel(Control*, String const&) (/home/narren/Src/godot/editor/editor_plugin.cpp:74)
[15] void call_with_ptr_args_ret_helper<__UnexistingClass, Button*, Control*, String const&, 0ul, 1ul>(__UnexistingClass*, Button* (__UnexistingClass::*)(Control*, String const&), void const**, void*, IndexSequence<0ul, 1ul>) (/home/narren/Src/godot/./core/variant/binder_common.h:324)
[16] void call_with_ptr_args_ret<__UnexistingClass, Button*, Control*, String const&>(__UnexistingClass*, Button* (__UnexistingClass::*)(Control*, String const&), void const**, void*) (/home/narren/Src/godot/./core/variant/binder_common.h:573)
[17] MethodBindTR<Button*, Control*, String const&>::ptrcall(Object*, void const**, void*) const (/home/narren/Src/godot/./core/object/method_bind.h:480)
[18] GDScriptFunction::call(GDScriptInstance*, Variant const**, int, Callable::CallError&, GDScriptFunction::CallState*) (/home/narren/Src/godot/modules/gdscript/gdscript_vm.cpp:2027)
[19] GDScriptInstance::callp(StringName const&, Variant const**, int, Callable::CallError&) (/home/narren/Src/godot/modules/gdscript/gdscript.cpp:1828)
[20] bool Node::_gdvirtual__enter_tree_call<false>() (/home/narren/Src/godot/./scene/main/node.h:259)
[21] Node::_propagate_enter_tree() (/home/narren/Src/godot/scene/main/node.cpp:219)
[22] Node::_set_tree(SceneTree*) (/home/narren/Src/godot/scene/main/node.cpp:2623)
[23] Node::_add_child_nocheck(Node*, StringName const&, Node::InternalMode) (/home/narren/Src/godot/scene/main/node.cpp:?)
[24] Node::add_child(Node*, bool, Node::InternalMode) (/home/narren/Src/godot/scene/main/node.cpp:?)
[25] EditorNode::add_editor_plugin(EditorPlugin*, bool) (/home/narren/Src/godot/editor/editor_node.cpp:3433)
[26] EditorNode::set_addon_plugin_enabled(String const&, bool, bool) (/home/narren/Src/godot/editor/editor_node.cpp:3574)
[27] EditorPluginSettings::_plugin_activity_changed() (/home/narren/Src/godot/editor/editor_plugin_settings.cpp:134)
[28] void call_with_variant_args_helper<EditorPluginSettings>(EditorPluginSettings*, void (EditorPluginSettings::*)(), Variant const**, Callable::CallError&, IndexSequence<>) (/home/narren/Src/godot/./core/variant/binder_common.h:298)
[29] void call_with_variant_args<EditorPluginSettings>(EditorPluginSettings*, void (EditorPluginSettings::*)(), Variant const**, int, Callable::CallError&) (/home/narren/Src/godot/./core/variant/binder_common.h:408)
[30] CallableCustomMethodPointer<EditorPluginSettings>::call(Variant const**, int, Variant&, Callable::CallError&) const (/home/narren/Src/godot/./core/object/callable_method_pointer.h:?)
[31] Callable::callp(Variant const**, int, Variant&, Callable::CallError&) const (/home/narren/Src/godot/core/variant/callable.cpp:51)
[32] Object::emit_signalp(StringName const&, Variant const**, int) (/home/narren/Src/godot/core/object/object.cpp:1047)
[33] Error Object::emit_signal<>(StringName const&) (/home/narren/Src/godot/./core/object/object.h:869)
[34] Tree::item_edited(int, TreeItem*, MouseButton) (/home/narren/Src/godot/scene/gui/tree.cpp:4235)
[35] Tree::propagate_mouse_event(Vector2i const&, int, int, int, bool, TreeItem*, MouseButton, Ref<InputEventWithModifiers> const&) (/home/narren/Src/godot/scene/gui/tree.cpp:2840)
[36] Tree::propagate_mouse_event(Vector2i const&, int, int, int, bool, TreeItem*, MouseButton, Ref<InputEventWithModifiers> const&) (/home/narren/Src/godot/scene/gui/tree.cpp:2958)
[37] Tree::gui_input(Ref<InputEvent> const&) (/home/narren/Src/godot/scene/gui/tree.cpp:3699)
[38] Control::_call_gui_input(Ref<InputEvent> const&) (/home/narren/Src/godot/scene/gui/control.cpp:?)
[39] Viewport::_gui_call_input(Control*, Ref<InputEvent> const&) (/home/narren/Src/godot/scene/main/viewport.cpp:1433)
[40] Viewport::_gui_input_event(Ref<InputEvent>) (/home/narren/Src/godot/scene/main/viewport.cpp:1662)
[41] Viewport::push_input(Ref<InputEvent> const&, bool) (/home/narren/Src/godot/scene/main/viewport.cpp:2862)
[42] Window::_window_input(Ref<InputEvent> const&) (/home/narren/Src/godot/scene/main/window.cpp:1384)
[43] Viewport::_sub_windows_forward_input(Ref<InputEvent> const&) (/home/narren/Src/godot/scene/main/viewport.cpp:2818)
[44] Viewport::push_input(Ref<InputEvent> const&, bool) (/home/narren/Src/godot/scene/main/viewport.cpp:2848)
[45] Window::_window_input(Ref<InputEvent> const&) (/home/narren/Src/godot/scene/main/window.cpp:1384)
[46] void call_with_variant_args_helper<Window, Ref<InputEvent> const&, 0ul>(Window*, void (Window::*)(Ref<InputEvent> const&), Variant const**, Callable::CallError&, IndexSequence<0ul>) (/home/narren/Src/godot/./core/variant/binder_common.h:293)
[47] void call_with_variant_args<Window, Ref<InputEvent> const&>(Window*, void (Window::*)(Ref<InputEvent> const&), Variant const**, int, Callable::CallError&) (/home/narren/Src/godot/./core/variant/binder_common.h:408)
[48] CallableCustomMethodPointer<Window, Ref<InputEvent> const&>::call(Variant const**, int, Variant&, Callable::CallError&) const (/home/narren/Src/godot/./core/object/callable_method_pointer.h:?)
[49] Callable::callp(Variant const**, int, Variant&, Callable::CallError&) const (/home/narren/Src/godot/core/variant/callable.cpp:51)
[50] DisplayServerX11::_dispatch_input_event(Ref<InputEvent> const&) (/home/narren/Src/godot/platform/linuxbsd/x11/display_server_x11.cpp:3588)
[51] DisplayServerX11::_dispatch_input_events(Ref<InputEvent> const&) (/home/narren/Src/godot/platform/linuxbsd/x11/display_server_x11.cpp:3560)
[52] Input::_parse_input_event_impl(Ref<InputEvent> const&, bool) (/home/narren/Src/godot/core/input/input.cpp:690)
[53] Input::flush_buffered_events() (/home/narren/Src/godot/core/input/input.cpp:940)
[54] DisplayServerX11::process_events() (/home/narren/Src/godot/platform/linuxbsd/x11/display_server_x11.cpp:4656)
[55] OS_LinuxBSD::run() (/home/narren/Src/godot/platform/linuxbsd/os_linuxbsd.cpp:885)
[56] /home/narren/Src/godot/bin/godot.linuxbsd.editor.dev.x86_64.llvm(main+0x22b) [0x55555a16f62b] (/home/narren/Src/godot/platform/linuxbsd/godot_linuxbsd.cpp:73)
[57] /usr/lib/libc.so.6(+0x23790) [0x7ffff7a3c790] (??:0)
[58] /usr/lib/libc.so.6(__libc_start_main+0x8a) [0x7ffff7a3c84a] (??:0)
[59] /home/narren/Src/godot/bin/godot.linuxbsd.editor.dev.x86_64.llvm(_start+0x25) [0x55555a16f325] (??:?)
-- END OF BACKTRACE --
================================================================

@maxcaplan
Copy link
Author

@narren96c You haven't found any work around for this have you?

@limbonaut
Copy link
Contributor

@maxcaplan Haven't looked into it yet. I would try adding await RenderingServer.frame_post_draw between steps. See if it helps, when viewport gets more time to work things out. And check at which step it breaks.

@limbonaut
Copy link
Contributor

limbonaut commented Apr 26, 2023

Stopped crashing for me without any changes to Godot or project files 🤷🏻
But the reproduction still crashes, so its different issues, perhaps.

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

Successfully merging a pull request may close this issue.

4 participants