On Mon, 25 Jul 2022 11:31:57 GMT, Jose Pereda <jper...@openjdk.org> wrote:

>> Paul has updated the pull request with a new target base due to a merge or a 
>> rebase. The incremental webrev excludes the unrelated changes brought in by 
>> the merge/rebase. The pull request contains seven additional commits since 
>> the last revision:
>> 
>>  - Merge branch 'master' into JDK-8181084
>>  - Merge branch 'master' into JDK-8181084
>>  - Updated variable names to be a bit more consistent
>>  - Merge branch 'master' into JDK-8181084
>>  - Merge branch 'master' into JDK-8181084
>>  - Removing trailing whitespace.
>>  - Correctly scales hi-res icons in MacOS system menu items
>
> modules/javafx.graphics/src/main/native-glass/mac/GlassMenu.m line 267:
> 
>> 265:             jclass pixelsClass = (*env)->FindClass(env, 
>> "com/sun/glass/ui/mac/MacPixels");
>> 266: 
>> 267:             jfieldID jPixelsWidthField = (*env)->GetFieldID(env, 
>> pixelsClass, "width", "I");
> 
> After each JNI call you need to check for exceptions like:
> 
> jfieldID jPixelsWidthField = (*env)->GetFieldID...
> if ((*env)->ExceptionCheck(env)) return;

Thanks @jperedadnr.
The last line inside that if block is `[image release]`. I am assuming that 
this is a memory cleanup from `(*env)->CallVoidMethod(env, pixels, 
jPixelsAttachData, ptr_to_jlong(&image));`. 

If I am adding the `ExceptionCheck` after each JNI call, should I make my 
block:-

jfloat scaley = (*env)->GetFloatField(env, pixels, jPixelsScaleYField);
if ((*env)->ExceptionCheck(env)) {
    [image release];
    return;
}

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

PR: https://git.openjdk.org/jfx/pull/743

Reply via email to