RFR: JDK-8313164: src/java.desktop/windows/native/libawt/windows/awt_Robot.cpp GetRGBPixels adjust releasing of resources
Thomas Stuefe
stuefe at openjdk.org
Wed Jul 26 11:34:42 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.
Okay. Did you find this with SonarCloud?
Since this is c++, it may be simpler to use RAII for this. Up to you though, the patch is also fine in its current form.
-------------
Marked as reviewed by stuefe (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/15038#pullrequestreview-1547515501
More information about the client-libs-dev
mailing list