Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8257242

[macOS] Java app crashes while switching input methods

    Details

    • Resolved In Build:
      b27
    • CPU:
      x86_64
    • OS:
      os_x

      Backports

        Description

        A DESCRIPTION OF THE PROBLEM :
        The patch for https://bugs.openjdk.java.net/browse/JDK-8248532 causes a crash, as it attempts to call a method selector on a class for an instance method (- keyboardInputSourceChanged).

        REGRESSION : Last worked in version 15.0.1

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        With a Java app running, switch input methods.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        It should not crash.
        ACTUAL -
        This will always crash with:

        2020-11-24 19:50:35.353 java[21393:1260549] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[AWTView keyboardInputSourceChanged:]: unrecognized selector sent to class 0x112b4b028'
        *** First throw call stack:
        (
        0 CoreFoundation 0x00007fff360c3b57 __exceptionPreprocess + 250
        1 libobjc.A.dylib 0x00007fff6ef565bf objc_exception_throw + 48
        2 CoreFoundation 0x00007fff36142b37 __CFExceptionProem + 0
        3 CoreFoundation 0x00007fff360283bb ___forwarding___ + 1427
        4 CoreFoundation 0x00007fff36027d98 _CF_forwarding_prep_0 + 120
        5 CoreFoundation 0x00007fff3603d80f __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
        6 CoreFoundation 0x00007fff3603d7a3 ___CFXRegistrationPost1_block_invoke + 63
        7 CoreFoundation 0x00007fff3603d718 _CFXRegistrationPost1 + 372
        8 CoreFoundation 0x00007fff3603d384 ___CFXNotificationPost_block_invoke + 80
        9 CoreFoundation 0x00007fff3600d4fd -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1554
        10 CoreFoundation 0x00007fff3600c9a9 _CFXNotificationPost + 1351
        11 Foundation 0x00007fff3868a786 -[NSNotificationCenter postNotificationName:object:userInfo:] + 59
        12 AppKit 0x00007fff336968ae __NSSelectedKeyboardInputSourcesChangedNotification + 58
        13 CoreFoundation 0x00007fff3603d80f __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
        14 CoreFoundation 0x00007fff3603d7a3 ___CFXRegistrationPost1_block_invoke + 63
        15 libdispatch.dylib 0x00007fff700a46c4 _dispatch_call_block_and_release + 12
        16 libdispatch.dylib 0x00007fff700a5658 _dispatch_client_callout + 8
        17 libdispatch.dylib 0x00007fff700b0cab _dispatch_main_queue_callback_4CF + 936
        18 CoreFoundation 0x00007fff36086e81 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
        19 CoreFoundation 0x00007fff36046c87 __CFRunLoopRun + 2028
        20 CoreFoundation 0x00007fff36045e3e CFRunLoopRunSpecific + 462
        21 HIToolbox 0x00007fff34c72abd RunCurrentEventLoopInMode + 292
        22 HIToolbox 0x00007fff34c727d5 ReceiveNextEventCommon + 584
        23 HIToolbox 0x00007fff34c72579 _BlockUntilNextEventMatchingListInModeWithFilter + 64
        24 AppKit 0x00007fff332b8039 _DPSNextEvent + 883
        25 AppKit 0x00007fff332b6880 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1352
        26 libosxapp.dylib 0x000000010a7c31c6 -[NSApplicationAWT nextEventMatchingMask:untilDate:inMode:dequeue:] + 166
        27 AppKit 0x00007fff332a858e -[NSApplication run] + 658
        28 libosxapp.dylib 0x000000010a7c2e6b +[NSApplicationAWT runAWTLoopWithApp:] + 171
        29 libawt_lwawt.dylib 0x0000000112b04f74 +[AWTStarter starter:headless:] + 468
        30 libawt_lwawt.dylib 0x0000000112b04d40 __20+[AWTStarter start:]_block_invoke + 64
        31 JavaNativeFoundation 0x00007fff3a962ff9 +[JNFRunLoop _performCopiedBlock:] + 15
        32 Foundation 0x00007fff3871c0dd __NSThreadPerformPerform + 204
        33 CoreFoundation 0x00007fff36047d52 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
        34 CoreFoundation 0x00007fff36047cf1 __CFRunLoopDoSource0 + 103
        35 CoreFoundation 0x00007fff36047b0b __CFRunLoopDoSources0 + 209
        36 CoreFoundation 0x00007fff3604683a __CFRunLoopRun + 927
        37 CoreFoundation 0x00007fff36045e3e CFRunLoopRunSpecific + 462
        38 libjli.dylib 0x000000010a5e1972 ParkEventLoop + 130
        39 libjli.dylib 0x000000010a5e0a60 MacOSXStartup + 192
        40 libjli.dylib 0x000000010a5e039f CreateExecutionEnvironment + 383
        41 libjli.dylib 0x000000010a5d8c39 JLI_Launch + 617
        42 java 0x000000010a5cfba4 main + 1108
        43 libdyld.dylib 0x00007fff700fecc9 start + 1
        )

        CUSTOMER SUBMITTED WORKAROUND :
        Revert the patch. (But where's the corresponding removeObserver, and why is addObserver called on every call to setInputMethod?)

        FREQUENCY : always


          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  psadhukhan Prasanta Sadhukhan
                  Reporter:
                  webbuggrp Webbug Group
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  7 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: