<AWT Dev> RFR: 8263490: [macos] Crash occurs on JPasswordField with activated InputMethod

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

<AWT Dev> RFR: 8263490: [macos] Crash occurs on JPasswordField with activated InputMethod

Toshio Nakamura
Hi,
Please review the fix for the issue of JPasswordField and activated InputMethod on macOS.
I don't think this condition is usual, but I'd like to avoid crash.

It needs two additional checks in "AWTView attributedSubstringForProposedRange:actualRange".

Tested test/jdk/java/awt on macOS Catalina and BigSur (both headful), and no regression was occurred.

-------------

Commit messages:
 - 8263490: [macos] Crash occurs on JPasswordField with activated InputMethod

Changes: https://git.openjdk.java.net/jdk/pull/2959/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2959&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8263490
  Stats: 5 lines in 1 file changed: 4 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2959.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2959/head:pull/2959

PR: https://git.openjdk.java.net/jdk/pull/2959
Reply | Threaded
Open this post in threaded view
|

Re: <AWT Dev> RFR: 8263490: [macos] Crash occurs on JPasswordField with activated InputMethod

Dmitry Markov-2
On Fri, 12 Mar 2021 08:16:09 GMT, Toshio Nakamura <[hidden email]> wrote:

> Hi,
> Please review the fix for the issue of JPasswordField and activated InputMethod on macOS.
> I don't think this condition is usual, but I'd like to avoid crash.
>
> It needs two additional checks in "AWTView attributedSubstringForProposedRange:actualRange".
>
> Tested test/jdk/java/awt on macOS Catalina and BigSur (both headful), and no regression was occurred.

Marked as reviewed by dmarkov (Reviewer).

-------------

PR: https://git.openjdk.java.net/jdk/pull/2959
Reply | Threaded
Open this post in threaded view
|

Re: <AWT Dev> RFR: 8263490: [macos] Crash occurs on JPasswordField with activated InputMethod

Sergey Bylokhov-2
On Fri, 12 Mar 2021 14:55:06 GMT, Dmitry Markov <[hidden email]> wrote:

>> Hi,
>> Please review the fix for the issue of JPasswordField and activated InputMethod on macOS.
>> I don't think this condition is usual, but I'd like to avoid crash.
>>
>> It needs two additional checks in "AWTView attributedSubstringForProposedRange:actualRange".
>>
>> Tested test/jdk/java/awt on macOS Catalina and BigSur (both headful), and no regression was occurred.
>
> Marked as reviewed by dmarkov (Reviewer).

As far as I understand the JPasswordField is affected because it disables InputMethods by default? I wonder why in this case we even try to run something in the native code?

-------------

PR: https://git.openjdk.java.net/jdk/pull/2959
Reply | Threaded
Open this post in threaded view
|

Re: <AWT Dev> RFR: 8263490: [macos] Crash occurs on JPasswordField with activated InputMethod

Toshio Nakamura
On Fri, 12 Mar 2021 23:34:08 GMT, Sergey Bylokhov <[hidden email]> wrote:

>> Marked as reviewed by dmarkov (Reviewer).
>
> As far as I understand the JPasswordField is affected because it disables InputMethods by default? I wonder why in this case we even try to run something in the native code?

I agree that disabling IM completely on JPasswordField is the fundamental fix, but the current macOS can still activate the prediction candidate feature even if the target component doesn't accept non ASCII characters. Then, the feature may call native codes.

I'd like to prevent crash this time. Also, the other IM related native codes in AWTView.m have similar checks, and only attributedSubstringForProposedRange lacks them.

-------------

PR: https://git.openjdk.java.net/jdk/pull/2959
Reply | Threaded
Open this post in threaded view
|

Re: <AWT Dev> RFR: 8263490: [macos] Crash occurs on JPasswordField with activated InputMethod

Sergey Bylokhov-2
In reply to this post by Toshio Nakamura
On Fri, 12 Mar 2021 08:16:09 GMT, Toshio Nakamura <[hidden email]> wrote:

> Hi,
> Please review the fix for the issue of JPasswordField and activated InputMethod on macOS.
> I don't think this condition is usual, but I'd like to avoid crash.
>
> It needs two additional checks in "AWTView attributedSubstringForProposedRange:actualRange".
>
> Tested test/jdk/java/awt on macOS Catalina and BigSur (both headful), and no regression was occurred.

Marked as reviewed by serb (Reviewer).

-------------

PR: https://git.openjdk.java.net/jdk/pull/2959
Reply | Threaded
Open this post in threaded view
|

Re: <AWT Dev> RFR: 8263490: [macos] Crash occurs on JPasswordField with activated InputMethod

Alexander Zuev-3
In reply to this post by Toshio Nakamura
On Fri, 12 Mar 2021 08:16:09 GMT, Toshio Nakamura <[hidden email]> wrote:

> Hi,
> Please review the fix for the issue of JPasswordField and activated InputMethod on macOS.
> I don't think this condition is usual, but I'd like to avoid crash.
>
> It needs two additional checks in "AWTView attributedSubstringForProposedRange:actualRange".
>
> Tested test/jdk/java/awt on macOS Catalina and BigSur (both headful), and no regression was occurred.

Marked as reviewed by kizune (Reviewer).

-------------

PR: https://git.openjdk.java.net/jdk/pull/2959
Reply | Threaded
Open this post in threaded view
|

Re: <AWT Dev> RFR: 8263490: [macos] Crash occurs on JPasswordField with activated InputMethod

Toshio Nakamura
In reply to this post by Dmitry Markov-2
On Fri, 12 Mar 2021 14:55:06 GMT, Dmitry Markov <[hidden email]> wrote:

>> Hi,
>> Please review the fix for the issue of JPasswordField and activated InputMethod on macOS.
>> I don't think this condition is usual, but I'd like to avoid crash.
>>
>> It needs two additional checks in "AWTView attributedSubstringForProposedRange:actualRange".
>>
>> Tested test/jdk/java/awt on macOS Catalina and BigSur (both headful), and no regression was occurred.
>
> Marked as reviewed by dmarkov (Reviewer).

@dmarkov20 @mrserb @azuev-java
Thank you for the review. Could one of you sponsor this fix?

-------------

PR: https://git.openjdk.java.net/jdk/pull/2959
Reply | Threaded
Open this post in threaded view
|

<AWT Dev> Integrated: 8263490: [macos] Crash occurs on JPasswordField with activated InputMethod

Toshio Nakamura
In reply to this post by Toshio Nakamura
On Fri, 12 Mar 2021 08:16:09 GMT, Toshio Nakamura <[hidden email]> wrote:

> Hi,
> Please review the fix for the issue of JPasswordField and activated InputMethod on macOS.
> I don't think this condition is usual, but I'd like to avoid crash.
>
> It needs two additional checks in "AWTView attributedSubstringForProposedRange:actualRange".
>
> Tested test/jdk/java/awt on macOS Catalina and BigSur (both headful), and no regression was occurred.

This pull request has now been integrated.

Changeset: 32c7fcc6
Author:    Toshio Nakamura <[hidden email]>
Committer: Dmitry Markov <[hidden email]>
URL:       https://git.openjdk.java.net/jdk/commit/32c7fcc6
Stats:     5 lines in 1 file changed: 4 ins; 0 del; 1 mod

8263490: [macos] Crash occurs on JPasswordField with activated InputMethod

Reviewed-by: dmarkov, serb, kizune

-------------

PR: https://git.openjdk.java.net/jdk/pull/2959