GitHub user matthiasblaesing added a comment to the discussion: Windows 
clipboard issues discussion

So another approach. As the agent idea is not well received, I tried to 
reproduce the problem with a plain JTextArea and a flavor listener. The problem 
is not reproducible there. So it is not just the flavor listener. Based on 
@xxDark analysis and @mbien idea to rebuild the JDK I augemented a JDK build 
with logging of the `WClipboard#openClipboard` and `WClipboard#closeClipboard` 
calls, including the stack traces.

I indeed saw two calls running in parallel, one from the native callback 
listening for clipboard changes and one coming from NetBeans copying data. The 
latter came from 
`org.openide.text.QuietEditorPane.DelegatingTransferHandler.exportToClipboard(JComponent,
 Clipboard, int)`. At that point the editor directly accesses the system 
clipboard and tries to export data. Given, that NetBeans has an abstraction 
called `ExClipboard` with the implemention `NbClipboard`, which goes to great 
lengths to retry copying, I created:

https://github.com/apache/netbeans/pull/8394

with that I get this result from the reproducer:

![grafik](https://github.com/user-attachments/assets/b44b886e-a8a0-4221-a5ae-23c2691fcdf2)

The reference from `master` showed many gaps on the `notepad.exe` side.

It would be great if others (@istinnstudio, @xxDark, @bradvido) could test the 
nightly available from: 
https://github.com/apache/netbeans/suites/36719959239/artifacts/2885407474

Two comments:
- there are other areas in the codebase that make calls to the clipboard, which 
might also need similar treatment for a complete fix, but the editor is the 
biggest pain point IMHO
- this might(!) fix clipboard history partly, as it routes the copy operation 
through `NbClipboard` (untested!!!!)


GitHub link: 
https://github.com/apache/netbeans/discussions/7051#discussioncomment-12730394

----
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

Reply via email to