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

Matthias Baesken mbaesken at openjdk.org
Wed Jul 26 11:12:41 UTC 2023


On Wed, 26 Jul 2023 10:43:20 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.

One additional idea - in case of  failing  IS_SAFE* checks (leading to the throw astd::bad_alloc) , should we add some tracing to make clear what went wrong ?  We have 
 J2dTraceLn1 / J2dTraceLn<n>  for this; unfortunately it seems to be only active for DEBUG-builds .

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

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



More information about the client-libs-dev mailing list