hxgodot-cpp icon indicating copy to clipboard operation
hxgodot-cpp copied to clipboard

[Mac OS][arm64][Godot Master Branch] Overriding _unhandled_input immediately crashes game.

Open davidbruce opened this issue 1 year ago • 1 comments

I was able to get HxGodot to build on my M1 MacBook by modifying the SConstruct to include arm64 as an architecture and pass -D HXCPP_ARM64, but it crashes immediately when overriding _unhandedled_input.

    override function _unhandled_input(event:InputEvent) {
        if (event.is_action_pressed("ui_accept", false, false) && retry.is_visible()) {
            get_tree().reload_current_scene();
        }
    }

Simply commenting out _unhandedled_input from HxMain.hx allows the 3d creeps to run as expected until the retry screen. An empty override also causes an immediate crash:

    override function _unhandled_input(event:InputEvent) { }

Godot Version: Main branch as of commit 30884ee3cca837f81efd85d68bcc5252976274cf (I also attempted 4 RC 5) Renderers tried: Forward+ and Compatibility HxGodot Version: Main branch as of commit 2bf1bc05726936b5a4b46c53338e323037276924 Haxe Version: 4.2.5 Architecture: ARM64

Crash Log:

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.0.rc.custom_build (c0f1ed57c44253c88a7d27e9727a305fb2155e51)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] 1   libsystem_platform.dylib            0x000000019a72f2a4 _sigtramp + 56
[2] std::__1::mutex::lock()
[3] std::__1::mutex::lock()
[4] Object::get_instance_binding(void*, GDExtensionInstanceBindingCallbacks const*) (in godot.macos.editor.arm64) + 44
[5] stc::HxMain_obj::virtual_HxMain__unhandled_input(cpp::Pointer<void>, cpp::Pointer<void>)
[6] virtual_HxMain__unhandled_input__onVirtualCall(void*, void* const*, void*)
[7] Node::_call_unhandled_input(Ref<InputEvent> const&) (in godot.macos.editor.arm64) + 252
[8] SceneTree::_call_input_pause(StringName const&, SceneTree::CallInputType, Ref<InputEvent> const&, Viewport*) (in godot.macos.editor.arm64) + 564
[9] Viewport::push_unhandled_input(Ref<InputEvent> const&, bool) (in godot.macos.editor.arm64) + 560
[10] Window::_window_input(Ref<InputEvent> const&) (in godot.macos.editor.arm64) + 608
[11] Window::~Window()
[12] DisplayServerMacOS::_dispatch_input_event(Ref<InputEvent> const&) (in godot.macos.editor.arm64) + 448
[13] Input::_parse_input_event_impl(Ref<InputEvent> const&, bool) (in godot.macos.editor.arm64) + 3904
[14] Input::flush_buffered_events() (in godot.macos.editor.arm64) + 76
[15] Input::release_pressed_events() (in godot.macos.editor.arm64) + 28
[16] DisplayServerMacOS::release_pressed_events() (in godot.macos.editor.arm64) + 40
[17] RendererCompositorRD::_create_current()
[18] 18  CoreFoundation                      0x000000019a7d5570 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 148
[19] 19  CoreFoundation                      0x000000019a873054 ___CFXRegistrationPost_block_invoke + 88
[20] 20  CoreFoundation                      0x000000019a872f9c _CFXRegistrationPost + 440
[21] 21  CoreFoundation                      0x000000019a7a6b74 _CFXNotificationPost + 708
[22] 22  Foundation                          0x000000019b69472c -[NSNotificationCenter postNotificationName:object:userInfo:] + 88
[23] 23  AppKit                              0x000000019dbbd7cc -[NSWindow resignKeyWindow] + 644
[24] 24  AppKit                              0x000000019dbbd4b0 _NXEndKeyAndMain + 128
[25] 25  AppKit                              0x000000019dbbc5f0 -[NSApplication _handleDeactivateEvent:] + 720
[26] 26  AppKit                              0x000000019db8bfb8 -[NSApplication(NSEvent) sendEvent:] + 1244
[27] Ref<DirAccess> DirAccess::_create_builtin<DirAccessMacOS>()
[28] DisplayServerMacOS::process_events() (in godot.macos.editor.arm64) + 176
[29] OS_MacOS::run() (in godot.macos.editor.arm64) + 104
[30] main (in godot.macos.editor.arm64) + 404
[31] 31  dyld                                0x000000019a3d7e50 start + 2544
-- END OF BACKTRACE --

davidbruce avatar Feb 26 '23 19:02 davidbruce

Thanks for this awesome bug-report! I think there is a problem with the argument pointers, I will have a look.

dazKind avatar Feb 27 '23 16:02 dazKind