On Thu, 27 Jul 2023 19:57:01 GMT, Alexey Ivanov <[email protected]> wrote:

>> Matthias Baesken has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   adjust checks and calculation of numPixels
>
> src/java.desktop/windows/native/libawt/windows/awt_Robot.cpp line 207:
> 
>> 205:         ::DeleteDC(hdcScreen);
>> 206:         throw std::bad_alloc();
>> 207:     }
> 
> I wonder if we can catch `std::bad_alloc` to release the resources and to 
> re-throw the exception.
> 
> Since a C++ exception is thrown, using try-catch for clean-up seems 
> reasonable, this would avoid duplicating the clean-up code in three places or 
> so.

Hi Alexey,  probably we could do this. Do you think it is worth the effort (we 
would have a big try catch block instead, but would centralize the  ::Delete* 
calls) ?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15038#discussion_r1277239372

Reply via email to