On Thu, 11 Sep 2025 03:13:13 GMT, Damon Nguyen <[email protected]> wrote:
>> In the scenario where AWT's UNLOCK API encounters a pendingException, the
>> env pointer throws the pendingException (as seen in `awt.h`). However, in
>> `Java_sun_awt_X11GraphicsDevice_pGetBounds`, after `AWT_UNLOCK`, the bounds
>> var is set. The exception check does not occur until after the bounds is
>> set, so the bounds may be set to an undesired value. This fix adds another
>> exception check to look for this pendingException after `AWT_UNLOCK`.
>
> Damon Nguyen has updated the pull request incrementally with one additional
> commit since the last revision:
>
> Change fix to return NULLs instead.
Changes requested by aivanov (Reviewer).
src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c line 1273:
> 1271: return NULL;
> 1272: }
> 1273: XFree(xinInfo);
Shouldn't we call `XFree` before returning here?
src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c line 1273:
> 1271: return NULL;
> 1272: }
> 1273: XFree(xinInfo);
Shouldn't we call XFree before returning here?
Suggestion:
XFree(xinInfo);
if (!bounds) {
return NULL;
}
src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c line 1294:
> 1292:
> 1293: bounds = (*env)->NewObject(env, clazz, mid, 0, 0,
> 1294: xwa.width, xwa.height);
I'm for reverting this change. The existing formatting was consistent in
indenting wrapped lines by 8 spaces. The new formatting doesn't stick to either
style: not 8 spaces, nor aligned to the opening parenthesis. The former is used
in the file, see lines 1289–1290.
-------------
PR Review: https://git.openjdk.org/jdk/pull/27110#pullrequestreview-3236069789
PR Review Comment: https://git.openjdk.org/jdk/pull/27110#discussion_r2356634195
PR Review Comment: https://git.openjdk.org/jdk/pull/27110#discussion_r2356640619
PR Review Comment: https://git.openjdk.org/jdk/pull/27110#discussion_r2356647179