[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-2d-dev
Subject:    Re: RFR: 8323664: java/awt/font/JNICheck/FreeTypeScalerJNICheck.java still fails with JNI warning on
From:       Christoph Langer <clanger () openjdk ! org>
Date:       2024-01-31 6:27:01
Message-ID: SIcLryTd40zNsPgff9jcQaXcnRzofXcDT8P5WuUqdXI=.292437ff-e532-4133-a164-17ddf0b16d1f () github ! com
[Download RAW message or body]

On Tue, 30 Jan 2024 14:03:39 GMT, Alexey Ivanov <aivanov@openjdk.org> wrote:

> Now that I re-read the problem statement and the exception handling JNI, the fix \
> doesn't look correct to me. 
> What does the warning say?
> 
> > WARNING in native method: JNI call made without checking exceptions when required \
> > to from `CallStaticVoidMethodV` at `sun.awt.Win32GraphicsEnvironment.initDisplay`
> 
> To me, it means that `Win32GraphicsEnvironment.initDisplay` is the problem. You \
> found that `DWMIsCompositionEnabled` calls a static method via \
> `JNU_CallStaticMethodByName`. 
> As far as I can see, it's the last statement of the `DWMIsCompositionEnabled` \
> function. 
> Then `Java_sun_awt_Win32GraphicsEnvironment_initDisplay` calls `initScreens` which, \
> seemingly, can call other JNI methods. 

Well, yes - however the initScreens only calls other JNI methods through the assert \
callback of debug builds, so not a general thing. The initial proposal for a fix was \
to add an exception check right to the call of \
[JNU_CallStaticMethodByName(...,"dwmCompositionChanged",...)](https://github.com/openjdk/jdk/pull/17404/commits/32128744252d75104e0d19f5eb701ffdc7b3d417) \
but was dismissed by @prrace 

I think the current proposal makes the assertion callback more resilient to JNI \
warnings in general, so I guess it's not bad.

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

PR Comment: https://git.openjdk.org/jdk/pull/17404#issuecomment-1918464139


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic