RFR: 8282862: AwtWindow::SetIconData leaks old icon handles if an exception is detected [v4]

Alexey Ivanov aivanov at openjdk.org
Thu Jan 16 21:15:36 UTC 2025


On Wed, 15 Jan 2025 21:52:52 GMT, Rajat Mahajan <rmahajan at openjdk.org> wrote:

>> **Issue:** 
>> AwtWindow::SetIconData leaks the old icon handles in hOldIcon and hOldIconSm if CreateIconFromRaster raises an exception. Additionally, an exception is checked only after the first call to CreateIconFromRaster.
>> 
>> **Solution:**
>> I have added the exception handling code to take care that the handles are properly destroyed and not leaked.
>> 
>> **Testing:**
>> I have tested the code to make sure there are no regressions caused by this.
>
> Rajat Mahajan has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Update code according to the feedback in code review

Looks good to me except for a tiny formatting nit.

src/java.desktop/windows/native/libawt/windows/awt_Window.cpp line 2111:

> 2109: 
> 2110: void AwtWindow::SetIconData(JNIEnv* env, jintArray iconRaster, jint w, jint h,
> 2111:                              jintArray smallIconRaster, jint smw, jint smh) {

I'd leave the opening brace where it is—on its own line. This style is followed in the entire file.

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

Marked as reviewed by aivanov (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/22932#pullrequestreview-2557293428
PR Review Comment: https://git.openjdk.org/jdk/pull/22932#discussion_r1919196008


More information about the client-libs-dev mailing list