On Mon, 6 Jan 2025 21:14:50 GMT, Rajat Mahajan <rmaha...@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:
> 
>   fix indentation and make sure we delete both handles.

Please update the copyright year for .cpp file.
Is there a way to test this fix or possibly add a test case?

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

> 2136:             DestroyIcon(m_hIconSm);
> 2137:         }
> 2138:         throw; // Re-throw the exception

Looks good here. I suppose you are cleaning up the resources in catch block 
since finally block isn't available in C++.

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

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

Reply via email to