RFR: 8348106: Catch C++ exception in Java_sun_awt_windows_WTaskbarPeer_setOverlayIcon
Alexey Ivanov
aivanov at openjdk.org
Mon Feb 24 13:20:58 UTC 2025
On Sat, 8 Feb 2025 04:02:08 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:
>> **Issue:**
>> The JNI method `Java_sun_awt_windows_WTaskbarPeer_setOverlayIcon `calls `CreateIconFromRaster `that can throw a C++ exception.
>>
>> The C++ exception must be caught and must not be allowed to escape the JNI method. The call to `CreateIconFromRaster `has to wrapped into a try-catch block.
>>
>> **Solution:**
>>
>> Added exception handling to make sure any exception from `CreateIconFromRaster `is handled properly.
>>
>> Testing done.
>
> It would be good to check what type of exception the methods chain can throw, is it only std::bad_alloc()? if yes, then we can use TRY + CATCH_BAD_ALLOC. If we can get another exception, we should figure out how we can report this error to the user.
@mrserb Could you take another look?
-------------
PR Comment: https://git.openjdk.org/jdk/pull/23470#issuecomment-2678395367
More information about the client-libs-dev
mailing list