On Mon, 3 Aug 2026 10:27:20 GMT, Matthias Baesken <[email protected]> wrote:

>> We miss to check the rv of GlobalAlloc at one code location, this should 
>> better be adjusted.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Matthias Baesken has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Check rv of GlobalLock

> Fine with me! I created https://bugs.openjdk.org/browse/JDK-8389674 for this.

Hi @prrace  , while working on JDK-8389674 I noticed another related thing.  
While the NULL check is present as it should be at some code locations, we call 
GlobalUnlock always, even if NULL was returned by GlobalLock. Should we change 
this and move the GlobalUnlock calls inside the if checks?  From what I found 
we will most likely not crash with the current code but it still seems to be 
not recommended.

https://github.com/openjdk/jdk/blob/87af1ead7d1d08fa02f2e90251e5254f384d2b67/src/java.desktop/windows/native/libawt/windows/awt_PrintJob.cpp#L688-L700

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

PR Comment: https://git.openjdk.org/jdk/pull/32151#issuecomment-5180779038

Reply via email to