GitHub user xxDark added a comment to the discussion: Windows clipboard issues discussion
It is also worth noting that my agent does more than serializing calls from AWT-Windows to EDT: it adds proper `synchronized` block to `handleContentsChanged` method in WClipboard. That is why I wanted for NetBeans team to test the fix themselves. The JDK change is lacking. After patching, the method looks like this: ```java private void handleContentsChanged() { if (AppContext.getAppContext() != null && !EventQueue.isDispatchThread()) { EventQueue.invokeLater(this::handleContentsChanged); return; } if (!areFlavorListenersRegistered()) { return; } long[] formats = null; synchronized (this) { try { openClipboard(null); formats = getClipboardFormats(); } catch (IllegalStateException exc) { // do nothing to handle the exception, call checkChange(null) } finally { closeClipboard(); } } checkChange(formats); } ``` The patched bytecode does essentially the same thing but without try/finally inserted by the compiler (synchronized is implemented using try/finally blocks in javac) because I did not want to spend time on properly re-implementing try/finally semantics so it does simple branching instead to do monitor unlocking. GitHub link: https://github.com/apache/netbeans/discussions/7051#discussioncomment-12764945 ---- This is an automatically sent email for notifications@netbeans.apache.org. To unsubscribe, please send an email to: notifications-unsubscr...@netbeans.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org For additional commands, e-mail: notifications-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists