RFR: 8353950: Clipboard interaction on Windows is unstable [v4]

Alisen Chung achung at openjdk.org
Mon Jun 2 16:55:07 UTC 2025


On Thu, 29 May 2025 17:11:12 GMT, Matthias Bläsing <mblaesing at openjdk.org> wrote:

>> - Introduce a lock into WClipboard that protects the code between
>>   openClipboard/closeClipboard invocations.
>>   The native side does not allow to open the clipboard multiple
>>   times or share the opened clipboard between multiple threads.
>> 
>> - Remove of need to call openClipboard/closeClipboard from
>>   getClipboardFormats by using the win32 call
>>   GetUpdatedClipboardFormats
>> 
>> - Prevent a race-condition by not registering the connection
>>   between java and native side of clipboard multiple time, but
>>   just at construction time.
>
> Matthias Bläsing has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Add headful key to the jtreg description

src/java.desktop/windows/classes/sun/awt/windows/WClipboard.java line 113:

> 111:     @Override
> 112:     public native void openClipboard(SunClipboard newOwner) throws IllegalStateException;
> 113:     /**

was this comment accidentally deleted?

test/jdk/java/awt/Clipboard/ConcurrentClipboardAccessTest.java line 31:

> 29:   @run main ConcurrentClipboardAccessTest
> 30:  */
> 31: import java.awt.*;

expand imports

test/jdk/java/awt/Clipboard/ConcurrentClipboardAccessTest.java line 58:

> 56:         public void run() {
> 57:             final Clipboard systemClipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
> 58:             while (true) {

will this cause the test to run until timeout if the thread isn't interrupted?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24614#discussion_r2121623003
PR Review Comment: https://git.openjdk.org/jdk/pull/24614#discussion_r2121693977
PR Review Comment: https://git.openjdk.org/jdk/pull/24614#discussion_r2121693822


More information about the client-libs-dev mailing list