Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
8257242: [macOS] Java app crashes while switching input methods
Browse files Browse the repository at this point in the history
Backport-of: 822ee47
  • Loading branch information
Olga Mikhaltsova authored and Yuri Nesterenko committed Dec 23, 2020
1 parent 9db1121 commit ea904d8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
3 changes: 0 additions & 3 deletions src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.h
Expand Up @@ -37,9 +37,6 @@

// TODO: NSMenu *contextualMenu;

// Keyboard layout
NSString *kbdLayout;

// dnd support (see AppKit/NSDragging.h, NSDraggingSource/Destination):
CDragSource *_dragSource;
CDropTarget *_dropTarget;
Expand Down
7 changes: 5 additions & 2 deletions src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m
Expand Up @@ -37,6 +37,9 @@
#import <Carbon/Carbon.h>
#import <JavaNativeFoundation/JavaNativeFoundation.h>

// keyboard layout
static NSString *kbdLayout;

@interface AWTView()
@property (retain) CDropTarget *_dropTarget;
@property (retain) CDragSource *_dragSource;
Expand Down Expand Up @@ -998,7 +1001,7 @@ - (void) insertText:(id)aString replacementRange:(NSRange)replacementRange
[self abandonInput];
}

- (void)keyboardInputSourceChanged:(NSNotification *)notification
+ (void)keyboardInputSourceChanged:(NSNotification *)notification
{
#ifdef IM_DEBUG
NSLog(@"keyboardInputSourceChangeNotification received");
Expand Down Expand Up @@ -1295,7 +1298,7 @@ static JNF_MEMBER_CACHE(jm_characterIndexForPoint, jc_CInputMethod,
jint index = JNFCallIntMethod(env, fInputMethodLOCKABLE, jm_characterIndexForPoint, (jint)flippedLocation.x, (jint)flippedLocation.y); // AWT_THREADING Safe (AWTRunLoopMode)

#ifdef IM_DEBUG
fprintf(stderr, "characterIndexForPoint returning %ld\n", index);
fprintf(stderr, "characterIndexForPoint returning %d\n", index);
#endif // IM_DEBUG

if (index == -1) {
Expand Down

1 comment on commit ea904d8

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.