Skip to content

Commit 45ed9e8

Browse files
Toshio NakamuraRealCLanger
Toshio Nakamura
authored andcommitted
8263490: [macos] Crash occurs on JPasswordField with activated InputMethod
Reviewed-by: shade Backport-of: 32c7fcc
1 parent 7c872ed commit 45ed9e8

File tree

1 file changed

+5
-1
lines changed
  • src/java.desktop/macosx/native/libawt_lwawt/awt

1 file changed

+5
-1
lines changed

src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -1185,8 +1185,12 @@ - (NSAttributedString *) attributedSubstringForProposedRange:(NSRange)theRange a
11851185
#ifdef IM_DEBUG
11861186
fprintf(stderr, "AWTView InputMethod Selector Called : [attributedSubstringFromRange] location=%lu, length=%lu\n", (unsigned long)theRange.location, (unsigned long)theRange.length);
11871187
#endif // IM_DEBUG
1188+
if (!fInputMethodLOCKABLE) {
1189+
return nil;
1190+
}
11881191

11891192
JNIEnv *env = [ThreadUtilities getJNIEnv];
1193+
GET_CIM_CLASS_RETURN(nil);
11901194
DECLARE_METHOD_RETURN(jm_substringFromRange, jc_CInputMethod, "attributedSubstringFromRange", "(II)Ljava/lang/String;", nil);
11911195
jobject theString = (*env)->CallObjectMethod(env, fInputMethodLOCKABLE, jm_substringFromRange, theRange.location, theRange.length);
11921196
CHECK_EXCEPTION_NULL_RETURN(theString, nil);

0 commit comments

Comments
 (0)