<AWT Dev> RFR 8248532:Every time I change keyboard language at my MacBook, Java crashes

Prasanta Sadhukhan prasanta.sadhukhan at oracle.com
Mon Aug 31 12:26:50 UTC 2020

Hi All,

Please review a fix for an issue in jdk/client where it is seen that 
everytime the keyboard language is changed in macos, it results in crash 
in mucommander app

The crash log shows

6 libjvm.dylib 0x000000010b88d44b signalHandler(int, __siginfo*, void*) 
+ 47
7 libsystem_platform.dylib 0x00007fff62a83b5d _sigtramp + 29
8 ??? 0x0000000000000004 0 + 4
9 com.apple.CoreFoundation 0x00007fff3696e1a0 
___CFXRegistrationPost_block_invoke + 63
10 com.apple.CoreFoundation 0x00007fff3696e10a _CFXRegistrationPost + 404
11 com.apple.CoreFoundation 0x00007fff369765b8 
___CFXNotificationPost_block_invoke + 87
12 com.apple.CoreFoundation 0x00007fff368def44 
-[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1642
13 com.apple.CoreFoundation 0x00007fff368de2f7 _CFXNotificationPost + 732
14 com.apple.Foundation 0x00007fff38b66a2b -[NSNotificationCenter 
postNotificationName:object:userInfo:] + 66
15 com.apple.CoreFoundation 0x00007fff3696e226 

The crash seems to happen when Java is bundled with the app and

does not happen if Java is run with Java launcher.

This seems to be an after-effect of JDK-8214578 fix where NSNotification 
code is added to detect change of keyboard layout.

Proposed fix is to use NSDistributedNotificationCenter for the 
notification handler.


it is seen that "NSNotificationCenter" This notification center handles 
notifications within a single process

whereas "NSDistributedNotificationCenter" This distributed notification 
center handles notifications that can be sent between processes on a 
single machine.

Since, the app is bundled with Java, notifications needed to handled 
between different processes in such case.

It is confirmed to have fixed the crash by this fix.

8214578testcase, SwingSet2 and other client jtreg headful tests with JCK 
tests has passed (link in JBS)

Bug: https://bugs.openjdk.java.net/browse/JDK-8248532

webrev: http://cr.openjdk.java.net/~psadhukhan/8248532/webrev.0/



More information about the awt-dev mailing list