Skip to content

macos: Crash after embedded process not being cleaned up #107916

Closed
@a-johnston

Description

@a-johnston

Tested versions

Tested on 4.5, introduced with #107182

System information

Godot v4.5.beta.mono (242b8ff) - macOS Sequoia (15.5.0) - Multi-window, 1 monitor - Metal (Forward+) - integrated Apple M2 (Apple8) - Apple M2 (8 threads) - 24.00 GiB memory

Issue description

Occasionally, after running a project with game embedding enabled, this crash occurs:

handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.5.beta.mono.custom_build (4e6ac9bccc7868432b9d8a009d34860a2e6f3393)
Dumping the backtrace. Please include this when reporting the bug on: https://github.com/godotengine/godot/issues
[1] invoke_previous_action(sigaction*, int, __siginfo*, void*, bool)
[2] 2   libsystem_platform.dylib            0x000000019e7d4624 _sigtramp + 56
[3] ScriptEditorDebugger::is_session_active() (in godot.macos.editor.dev.arm64.mono) (/Users/adam/code/godot/./editor/debugger/script_editor_debugger.h:324)
[4] ScriptEditorDebugger::_put_msg(String const&, Array const&, unsigned long long) (in godot.macos.editor.dev.arm64.mono) (/Users/adam/code/godot/editor/debugger/script_editor_debug
ger.cpp:75)
[5] ScriptEditorDebugger::send_message(String const&, Array const&) (in godot.macos.editor.dev.arm64.mono) (/Users/adam/code/godot/editor/debugger/script_editor_debugger.cpp:1969)
[6] EmbeddedProcessMacOS::display_state_changed() (in godot.macos.editor.dev.arm64.mono) (/Users/adam/code/godot/platform/macos/editor/embedded_process_macos.mm:141)
[7] DisplayServerMacOS::_window_update_display_id(DisplayServerMacOS::WindowData*) (in godot.macos.editor.dev.arm64.mono) (/Users/adam/code/godot/platform/macos/display_server_macos.
mm:3224)
[8] DisplayServerMacOS::reparent_check(int) (in godot.macos.editor.dev.arm64.mono) (/Users/adam/code/godot/platform/macos/display_server_macos.mm:2100)
[9] DisplayServerMacOS::window_set_transient(int, int) (in godot.macos.editor.dev.arm64.mono) (/Users/adam/code/godot/platform/macos/display_server_macos.mm:2257)
[10] DisplayServerMacOS::create_sub_window(DisplayServer::WindowMode, DisplayServer::VSyncMode, unsigned int, Rect2i const&, bool, int) (in godot.macos.editor.dev.arm64.mono) (/Users
/adam/code/godot/platform/macos/display_server_macos.mm:1905)
[11] Window::_make_window() (in godot.macos.editor.dev.arm64.mono) (/Users/adam/code/godot/scene/main/window.cpp:665)
[12] Window::set_visible(bool) (in godot.macos.editor.dev.arm64.mono) (/Users/adam/code/godot/scene/main/window.cpp:940)
[13] Window::popup(Rect2i const&) (in godot.macos.editor.dev.arm64.mono) (/Users/adam/code/godot/scene/main/window.cpp:1993)

this is due to the workaround for #107066 setting the embedding process state to a new value CLOSED which then prevents the process from being cleaned up. Other code paths can later trigger calls against the bad values, leading to the crash. I verified that if the window was closed rather than stop/abort being hit in the editor, embedded_processes will keep its size and never go back down to empty.

Steps to reproduce

Run a project several times with game embedding enabled and close the project by closing the window rather than hitting stop/abort in the editor. Eventually the editor will crash.

Minimal reproduction project (MRP)

n/a; related to any project being run with embedding rather than a particular node structure/code being used.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Release Blocker

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions