Skip to content

Commit

Permalink
8263490: [macos] Crash occurs on JPasswordField with activated InputM…
Browse files Browse the repository at this point in the history
…ethod

Reviewed-by: dmarkov, serb, kizune
  • Loading branch information
Toshio Nakamura authored and dmarkov20 committed Mar 15, 2021
1 parent 8afec70 commit 32c7fcc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -1164,8 +1164,12 @@ - (NSAttributedString *) attributedSubstringForProposedRange:(NSRange)theRange a
#ifdef IM_DEBUG
fprintf(stderr, "AWTView InputMethod Selector Called : [attributedSubstringFromRange] location=%lu, length=%lu\n", (unsigned long)theRange.location, (unsigned long)theRange.length);
#endif // IM_DEBUG
if (!fInputMethodLOCKABLE) {
return nil;
}

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

0 comments on commit 32c7fcc

Please sign in to comment.