kwhat / jnativehook

Global keyboard and mouse listeners for Java.
Other
1.73k stars 344 forks source link

Crash under Mac OS when some function keys are pressed #395

Open avrilmaomao opened 2 years ago

avrilmaomao commented 2 years ago

I cannot reproduce on my computer(macOS Monterey 12.0.1) ,but our customer kept having this problem.

Step to reproduce on his computer(macOS BigSur 11.1):

  1. Start to Listen to events. Our code is like this (Using JNativeHook 2.2.1 from Maven Central)
            GlobalScreen.registerNativeHook();
            GlobalScreen.setEventDispatcher(new DefaultDispatchService());
            GlobalScreen.addNativeKeyListener(this.nativeKeyListener);
            GlobalScreen.addNativeMouseListener(this.nativeMouseListener);
            GlobalScreen.addNativeMouseWheelListener(this.nativeMouseWheelListener); 
  2. Press F7 .

crash report content starts as followed:

Crashed Thread:        54  Java: JNativeHook Hook Thread

Exception Type:        EXC_BAD_ACCESS (SIGABRT)
Exception Codes:       KERN_INVALID_ADDRESS at 0x00000000000000f0
Exception Note:        EXC_CORPSE_NOTIFY

VM Regions Near 0xf0:
--> 
    __TEXT                      10412c000-104144000    [   96K] r-x/r-x SM=COW  /Applications/云队友.app/Contents/MacOS/云队友

Application Specific Information:
BUG IN CLIENT OF LIBDISPATCH: Assertion failed: Block was expected to execute on queue [com.apple.main-thread]
abort() called

Full report file is attached. macos-crash.log

kwhat commented 2 years ago

BUG IN CLIENT OF LIBDISPATCH: Assertion failed: Block was expected to execute on queue [com.apple.main-thread]

Well look at that, Apple's error messages have improved!

So 10.15 is the most recent version of OS X I am able to run at the moment and I cannot duplicate this issue on that system. I wont be able to look into this until I can duplicate it.

kwhat commented 2 years ago

Has this been tested with 2.2.2? There was a crash fixed on OS X with the caps-lock key that maybe related.