godot icon indicating copy to clipboard operation
godot copied to clipboard

Subviewport creates duplicate node that persists between scenes. Hard crash when interacting with the editor viewport.

Open TheeStickmahn opened this issue 1 year ago • 1 comments

Tested versions

  • Reproducible in v4.3.rc1.mono.official, v4.2.1.stable.mono.official

System information

Godot v4.3.rc1.mono - Arch Linux 6.10.1.arch1-1 Wed, 24 Jul 2024 22:25:43 +0000 - Wayland - Vulkan (Forward+) - dedicated AMD Radeon RX 6700 XT - AMD Ryzen 5 5600G with Radeon Graphics (12 Threads)

Issue description

I am gonna be honest here. I do not know why this happens.

I'm currently creating a plugin that has a dedicated main screen, which includes a SubViewport. That SubViewport has a Camera3D & MeshInstance3D as children. When the plugin loads, a sort of "phantom node" gets created. A mesh gets rendered on screen, at the same location as the world location of the plugin's MeshInstance3D. It does not show up in the node tree, and when the viewport gets clicked on, it hard crashes.

Running it through the terminal threw this out when it crashed:

Godot Engine v4.3.rc1.mono.official.e343dbbcc - https://godotengine.org
Inconsistent value (1) for DRI_PRIME. Should be < 1 (GPU devices count). Using: 0
OpenGL API 4.6 (Core Profile) Mesa 24.1.4-arch1.2 - Compatibility - Using Device: AMD - AMD Radeon RX 6700 XT (radeonsi, navi22, LLVM 18.1.8, DRM 3.57, 6.10.1-arch1-1)

Editing project: /home/thestickmahn/Godot Projects/imgonnafuckingkms
Godot Engine v4.3.rc1.mono.official.e343dbbcc - https://godotengine.org
Vulkan 1.3.280 - Forward+ - Using Device #0: AMD - AMD Radeon RX 6700 XT

ERROR: Condition "!is_ancestor_of(p_start_node)" is true. Returning: p_start_node
   at: get_deepest_editable_node (scene/main/node.cpp:2525)
ERROR: Condition "!is_ancestor_of(p_node)" is true. Returning: false
   at: is_editable_instance (scene/main/node.cpp:2518)
ERROR: Condition "!is_ancestor_of(p_node)" is true. Returning: false
   at: is_editable_instance (scene/main/node.cpp:2518)
ERROR: Condition "!is_ancestor_of(p_node)" is true. Returning: false
   at: is_editable_instance (scene/main/node.cpp:2518)

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.3.rc1.mono.official (e343dbbcc1030f04dc5833f1c19d267a17332ca9)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.6/libcoreclr.so(+0x4a0c15) [0x7c6d68ea0c15] (??:0)
[2] /usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.6/libcoreclr.so(+0x4a0255) [0x7c6d68ea0255] (??:0)
[3] /usr/lib/libc.so.6(+0x3d1d0) [0x7c6d9fa371d0] (??:0)
[4] /home/thestickmahn/.local/share/applications/godot/Godot_v4.3-rc1_mono_linux_x86_64/Godot_v4.3-rc1_mono_linux.x86_64() [0x40ca4a] (??:0)
[5] /home/thestickmahn/.local/share/applications/godot/Godot_v4.3-rc1_mono_linux_x86_64/Godot_v4.3-rc1_mono_linux.x86_64() [0x1aad20b] (??:0)
[6] /home/thestickmahn/.local/share/applications/godot/Godot_v4.3-rc1_mono_linux_x86_64/Godot_v4.3-rc1_mono_linux.x86_64() [0x1ad7429] (??:0)
[7] /home/thestickmahn/.local/share/applications/godot/Godot_v4.3-rc1_mono_linux_x86_64/Godot_v4.3-rc1_mono_linux.x86_64() [0x436d5d1] (??:0)
[8] /home/thestickmahn/.local/share/applications/godot/Godot_v4.3-rc1_mono_linux_x86_64/Godot_v4.3-rc1_mono_linux.x86_64() [0x25365dd] (??:0)
[9] /home/thestickmahn/.local/share/applications/godot/Godot_v4.3-rc1_mono_linux_x86_64/Godot_v4.3-rc1_mono_linux.x86_64() [0x23ba825] (??:0)
[10] /home/thestickmahn/.local/share/applications/godot/Godot_v4.3-rc1_mono_linux_x86_64/Godot_v4.3-rc1_mono_linux.x86_64() [0x240ea62] (??:0)
[11] /home/thestickmahn/.local/share/applications/godot/Godot_v4.3-rc1_mono_linux_x86_64/Godot_v4.3-rc1_mono_linux.x86_64() [0x2412076] (??:0)
[12] /home/thestickmahn/.local/share/applications/godot/Godot_v4.3-rc1_mono_linux_x86_64/Godot_v4.3-rc1_mono_linux.x86_64() [0x242a759] (??:0)
[13] /home/thestickmahn/.local/share/applications/godot/Godot_v4.3-rc1_mono_linux_x86_64/Godot_v4.3-rc1_mono_linux.x86_64() [0x4a7277e] (??:0)
[14] /home/thestickmahn/.local/share/applications/godot/Godot_v4.3-rc1_mono_linux_x86_64/Godot_v4.3-rc1_mono_linux.x86_64() [0x4bd16f] (??:0)
[15] /home/thestickmahn/.local/share/applications/godot/Godot_v4.3-rc1_mono_linux_x86_64/Godot_v4.3-rc1_mono_linux.x86_64() [0x40c47c7] (??:0)
[16] /home/thestickmahn/.local/share/applications/godot/Godot_v4.3-rc1_mono_linux_x86_64/Godot_v4.3-rc1_mono_linux.x86_64() [0x40c60ff] (??:0)
[17] /home/thestickmahn/.local/share/applications/godot/Godot_v4.3-rc1_mono_linux_x86_64/Godot_v4.3-rc1_mono_linux.x86_64() [0x4c41e5] (??:0)
[18] /home/thestickmahn/.local/share/applications/godot/Godot_v4.3-rc1_mono_linux_x86_64/Godot_v4.3-rc1_mono_linux.x86_64() [0x41ff23] (??:0)
[19] /usr/lib/libc.so.6(+0x25e08) [0x7c6d9fa1fe08] (??:0)
[20] /usr/lib/libc.so.6(__libc_start_main+0x8c) [0x7c6d9fa1fecc] (??:0)
[21] /home/thestickmahn/.local/share/applications/godot/Godot_v4.3-rc1_mono_linux_x86_64/Godot_v4.3-rc1_mono_linux.x86_64() [0x43e4ca] (??:0)
-- END OF BACKTRACE --
================================================================

Steps to reproduce

I, for the life of me do not know.

Minimal reproduction project (MRP)

Project ZIP: imgonnafuckingkms.zip

I will provide further information as required.

TheeStickmahn avatar Jul 27 '24 19:07 TheeStickmahn

https://github.com/user-attachments/assets/4cb6904b-215a-45e5-9283-ca3afa41b3be

Recorded an example, because why not. (Sorry for low bitrate. Bad recording settings :3)

TheeStickmahn avatar Jul 27 '24 19:07 TheeStickmahn

I just happened to be working on a similar project and experienced the same issue.

One easy fix for now would be to tell your SubViewport to use its own 3d world. The crash is an issue with how the engine handles the selection of nodes. You are seeing 2 of the same nodes because you are appending them to the main screen (using their own 3d world fixes the duplicate nodes and thus prevents selection crash)

EditorInterface.get_editor_main_screen().add_child(mainPanelInstance)

Heres an updated project with the example below:

94844-fix-attempt-1.zip

image image image

The crash is an issue with how the engine handles the selection of nodes, going to attempt to fix this in this pr: https://github.com/godotengine/godot/pull/94916

yahkr avatar Jul 29 '24 13:07 yahkr

@yahkr's fix worked! issue closed

TheeStickmahn avatar Jul 29 '24 15:07 TheeStickmahn

Please do not close issues before the change has been merged, it will be closed automatically

AThousandShips avatar Jul 29 '24 15:07 AThousandShips

Please do not close issues before the change has been merged, it will be closed automatically

ok oopsies

TheeStickmahn avatar Jul 29 '24 15:07 TheeStickmahn

Fixed by https://github.com/godotengine/godot/pull/95420

yahkr avatar Aug 19 '24 01:08 yahkr