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

Dragging any Resource not recognized by the editor over the viewport crashes Godot #89093

Closed
coppolaemilio opened this issue Mar 2, 2024 · 4 comments · Fixed by #89126
Closed

Comments

@coppolaemilio
Copy link
Member

Tested versions

v4.3.dev4.official [df78c06]

System information

Godot v4.3.dev4 - macOS 14.2.1 - Vulkan (Forward+) - integrated Apple M1 Pro - Apple M1 Pro (10 Threads)

Issue description

When dragging a theme over the viewport, the editor crashes.

Kapture.2024-03-02.at.18.35.44.mp4

I get this from the crash dialog, not sure if it helps:

-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Process:               Godot [94104]
Path:                  /Applications/Godot.app/Contents/MacOS/Godot
Identifier:            org.godotengine.godot
Version:               4.3 (4.3)
Code Type:             ARM-64 (Native)
Parent Process:        launchd [1]
User ID:               501

Date/Time:             2024-03-02 18:35:36.4833 +0100
OS Version:            macOS 14.2.1 (23C71)
Report Version:        12
Anonymous UUID:        33ED798A-8EC3-E728-0035-E4E197B21DF8

Sleep/Wake UUID:       14A2FDC0-AF33-4169-BAFF-3E500503288E

Time Awake Since Boot: 540000 seconds
Time Since Wake:       12305 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGABRT)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000188
Exception Codes:       0x0000000000000001, 0x0000000000000188

Termination Reason:    Namespace SIGNAL, Code 6 Abort trap: 6
Terminating Process:   Godot [94104]

VM Region Info: 0x188 is not in any region.  Bytes before following region: 105554726878840
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      MALLOC_NANO              600060000000-600080000000 [512.0M] rw-/rwx SM=PRV  

Application Specific Information:
abort() called

If I don't hover with the dragged resource over the viewport and play a game of moving only around the editor, it doesn't crashes. So I assume that there is something going wrong when trying to make a preview of the resource in the viewport? or something like that 🤷‍♂️

Kapture.2024-03-02.at.18.38.44.mp4

Steps to reproduce

Download the project, drag the res://UI/MainTheme.tres into the viewport.

Minimal reproduction project (MRP)

This is the current project I'm using on the videos. It is not a super minimal version of it, but it is small enough.

MRP.zip

@KoBeWi
Copy link
Member

KoBeWi commented Mar 2, 2024

CrashHandlerException: Program crashed
Engine version: Godot Engine v4.3.dev.custom_build (9fc1d6eb3634007f4103cafbdfd5f2ab58753bfb)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[0] CowData<char32_t>::_ref (C:\godot_source\core\templates\cowdata.h:459)
[1] String::String (C:\godot_source\core\string\ustring.h:458)
[2] Node::get_scene_file_path (C:\godot_source\scene\main\node.cpp:2414)
[3] CanvasItemEditorViewport::can_drop_data (C:\godot_source\editor\plugins\canvas_item_editor_plugin.cpp:5942)
[4] Viewport::_gui_drop (C:\godot_source\scene\main\viewport.cpp:1748)
[5] Viewport::_gui_input_event (C:\godot_source\scene\main\viewport.cpp:2109)
[6] Viewport::push_input (C:\godot_source\scene\main\viewport.cpp:3375)
[7] Window::_window_input (C:\godot_source\scene\main\window.cpp:1611)
[8] call_with_variant_args_helper<Window,Ref<InputEvent> const &,0> (C:\godot_source\core\variant\binder_common.h:304)
[9] call_with_variant_args<Window,Ref<InputEvent> const &> (C:\godot_source\core\variant\binder_common.h:419)
[10] CallableCustomMethodPointer<Window,Ref<InputEvent> const &>::call (C:\godot_source\core\object\callable_method_pointer.h:99)
[11] Callable::callp (C:\godot_source\core\variant\callable.cpp:58)
[12] Callable::call<Ref<InputEvent> > (C:\godot_source\core\variant\variant.h:864)
[13] DisplayServerWindows::_dispatch_input_event (C:\godot_source\platform\windows\display_server_windows.cpp:3155)
[14] DisplayServerWindows::_dispatch_input_events (C:\godot_source\platform\windows\display_server_windows.cpp:3125)
[15] Input::_parse_input_event_impl (C:\godot_source\core\input\input.cpp:773)
[16] Input::flush_buffered_events (C:\godot_source\core\input\input.cpp:1044)
[17] DisplayServerWindows::process_events (C:\godot_source\platform\windows\display_server_windows.cpp:2674)
[18] OS_Windows::run (C:\godot_source\platform\windows\os_windows.cpp:1476)
[19] widechar_main (C:\godot_source\platform\windows\godot_windows.cpp:182)
[20] _main (C:\godot_source\platform\windows\godot_windows.cpp:204)
[21] main (C:\godot_source\platform\windows\godot_windows.cpp:218)
[22] WinMain (C:\godot_source\platform\windows\godot_windows.cpp:232)
[23] __scrt_common_main_seh (D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288)
[24] <couldn't map PC to fn name>
-- END OF BACKTRACE --

Happens with any Resource not recognized by the editor. Fixing it requires a simple null check.

@akien-mga akien-mga added this to the 4.3 milestone Mar 2, 2024
@coppolaemilio coppolaemilio changed the title Dragging a theme over the viewport crashes the editor Dragging any Resource not recognized by the editor over the viewport crashes Godot Mar 3, 2024
@luevano
Copy link
Contributor

luevano commented Mar 3, 2024

I think it is actually related to #88829?

[3] CanvasItemEditorViewport::can_drop_data (C:\godot_source\editor\plugins\canvas_item_editor_plugin.cpp:5942) this section of the code points to a commit related to that PR, may I attempt a fix for this?

@luevano
Copy link
Contributor

luevano commented Mar 3, 2024

I have a fix ready but I'm not sure if I'm capturing all scenarios; @KoBeWi what other Resources did you test with?

How did you get that log?

@KoBeWi
Copy link
Member

KoBeWi commented Mar 3, 2024

This bug happens for any resource that isn't Texture2D or PackedScene. You can get a log by crashing in a build with debug symbols (e.g. dev_build=yes in scons).

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