RFR: 8270269: Desktop.browse method fails if earlier CoInitialize call as COINIT_MULTITHREADED [v3]

Sergey Bylokhov serb at openjdk.org
Mon Dec 11 18:39:35 UTC 2023


On Fri, 8 Dec 2023 17:12:29 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

>> The fix for a regression caused by the https://bugs.openjdk.org/browse/JDK-6508941. it does not take into account RPC_E_CHANGED_MODE when COM was already initialized using COINIT_MULTITHREADED mode.
>> 
>> @aivanov-jdk please take a look.
>
> Sergey Bylokhov has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Update src/java.desktop/windows/native/libawt/windows/awt_Desktop.cpp
>   
>   date
>   
>   Co-authored-by: Alexey Ivanov <alexey.ivanov at oracle.com>

>The confusion could come from https://github.com/openjdk/jdk/pull/14898 where https://github.com/openjdk/jdk/pull/14898#issuecomment-1748967705 us from calling DirectSound API which supports both MTA and STA.

Would like to clarify difference between this and that patch: this bug shows that some api does not support MTA mode, and intentionally requests the STA - so our code was broken by some external call -> enable COM+MTA.
At the same time the [patch](https://github.com/openjdk/jdk/pull/14898) may change the current mode of the thread from STA to MTA and that seems could break all code executed after?

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

PR Comment: https://git.openjdk.org/jdk/pull/17010#issuecomment-1850662854


More information about the client-libs-dev mailing list