[ANNOUNCEMENT] Updated: cygutils 1.4.16-7
Sun Sep 26 09:40:11 GMT 2021
Takashi Yano via Cygwin wrote:
> Sometimes, putclip shows error
> "Unable to open the clipboard"
> when I run 'echo A | putclip'.
> I digged into this problem, and found OpenClipboard() sometimes
> fails with error ERROR_ACCESS_DENIED if it is called just after
> SetClipboardData() and CloseClipboard().
> Currently, putclip calls OpenClipboard()/CloseClipboard() four
> times. Is there any reason why closing and reopening clipboard
> several times?
I don't know why the author coded putclip that way. Perhaps Windows required
different clipboard interfacing long ago? Or the author was being very cautious?
> Is there any problem if you open clipboard once and close it at
> the end of function int putclip() just like the patch attached?
> The problem above disappears if the patch is applied.
I will implement something similar to your patch for -8 in the next few days.
Thank you for digging into this issue; I had seen evidence the clipboard was busy
but wondered why Windows itself couldn't serialize access. It's amusing to find
that putclip is apparently interfering with itself :-).
More information about the Cygwin