Skip to content

Example apps segfault on macOS when opening spotlight menu #104

Closed

Description

@jdm
godot2:winit jdm$ lldb target/debug/examples/window
(lldb) target create "target/debug/examples/window"
Current executable set to 'target/debug/examples/window' (x86_64).
(lldb) r
Process 18636 launched: '/Users/jdm/src/winit/target/debug/examples/window' (x86_64)
Awakened
Focused(true)
MouseLeft
Awakened
KeyboardInput(Pressed, 55, Some(LWin))
Process 18636 stopped
* thread #1: tid = 0x47bdc, 0xffffea3effffea3e, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xffffea3effffea3e)
    frame #0: 0xffffea3effffea3e
error: memory read failed for 0xffffea3effffea00
(lldb) bt
* thread #1: tid = 0x47bdc, 0xffffea3effffea3e, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xffffea3effffea3e)
  * frame #0: 0xffffea3effffea3e
    frame #1: 0x00007fff8d571043 libunwind.dylib`unwind_phase2_forced + 128
    frame #2: 0x00007fff8d570fa4 libunwind.dylib`_Unwind_Resume + 72
    frame #3: 0x000000010001554a window`winit::platform::platform::NSEventToEvent(window=0x00007fff5fbff930, nsevent=0x0000000100221050) + 6458 at mod.rs:804
    frame #4: 0x00000001000107ae window`winit::platform::platform::{{impl}}::next(self=0x00007fff5fbff7c0) + 846 at mod.rs:254
    frame #5: 0x00000001000031bc window`winit::window::{{impl}}::next(self=0x00007fff5fbff7c0) + 44 at window.rs:402
    frame #6: 0x000000010000341b window`window::main + 283 at window.rs:14
    frame #7: 0x000000010003a53b window`panic_unwind::__rust_maybe_catch_panic + 27 at lib.rs:97
    frame #8: 0x0000000100039a07 window`std::rt::lang_start [inlined] std::panicking::try<(),fn()> + 44 at panicking.rs:332
    frame #9: 0x00000001000399db window`std::rt::lang_start [inlined] std::panic::catch_unwind<fn(),()> at panic.rs:351
    frame #10: 0x00000001000399db window`std::rt::lang_start + 347 at rt.rs:57
    frame #11: 0x000000010000379a window`main + 42
    frame #12: 0x00007fff94ad75fd libdyld.dylib`start + 1

Activity

  1. jdm commented on Dec 21, 2016

    @jdm
    ContributorAuthor

    I'm running 10.9.5 when I see this happen.

  2. added
    DS - appkit
    B - bug
    on Dec 21, 2016
  3. mitchmindtree commented on Dec 22, 2016

    @mitchmindtree
    Contributor

    Can confirm this also occurs on 10.10.5.

  4. davll commented on Jan 14, 2017

    @davll

    Can confirm this also occurs on 10.11.6.
    Seems that the application received an event from spotlight window and winit::platform::platform::NSEventToEvent failed to handle it.

  5. davll commented on Jan 14, 2017

    @davll

    Not only spotlight window, but also opening system menu (ex: battery status, wifi menu) will invoke the same segfault.

  6. mitchmindtree commented on Feb 5, 2017

    @mitchmindtree
    Contributor

    Ok it seems like this is occurring because the [NSEvent type] method is returning a value that is not enumerated within the NSEventType enum from the cocoa-rs crate. E.g. If you try to debug print the returned NSEventType the app segfaults, however if you first cast it to u64 it prints 21 - a value that is not enumerated in the enum itself. Going to dig further to see if I can find the missing events and add them to the enum upstream.

    Edit: I should add: Spotlight, wifi menu, battery status, etc all return the mystery 21 value.

  7. added a commit that references this issue on Feb 5, 2017
    06c1b59
  8. mitchmindtree commented on Feb 5, 2017

    @mitchmindtree
    Contributor

    I couldn't find any documentation on NSEventType values of 21 anywhere so I've added a temporary fix in our event handling in this commit as a part of #132.

  9. mitchmindtree commented on Feb 5, 2017

    @mitchmindtree
    Contributor

    I've added an issue upstream at servo/cocoa-rs#155.

  10. added a commit that references this issue on Mar 1, 2017
    a90f991
  11. added a commit that references this issue on Mar 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    B - bugDS - appkit

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions