RFR: JDK-8313164: src/java.desktop/windows/native/libawt/windows/awt_Robot.cpp GetRGBPixels adjust releasing of resources [v2]

Matthias Baesken mbaesken at openjdk.org
Wed Jul 26 12:56:50 UTC 2023


On Wed, 26 Jul 2023 11:59:06 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

>> In src/java.desktop/windows/native/libawt/windows/awt_Robot.cpp GetRGBPixels we release some resources at the end of the function by calling DeleteObject/DeleteDC. This is recommended by the MS API docs.
>> However this should be done as well in some early leaving with throw that can occur in this function.
>
> Matthias Baesken has updated the pull request incrementally with one additional commit since the last revision:
> 
>   adjust checks and calculation of numPixels

Hi Thomas , I just found those while looking at some other resource alloc/freeing, no Sonatype or similar was used.

Regarding RAII , not sure if something like this is used in the awt native code (or are there some good examples in awt native code?) . So I better keep it as it is, to be consistent with the codebase around it.

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

PR Comment: https://git.openjdk.org/jdk/pull/15038#issuecomment-1651748809



More information about the client-libs-dev mailing list