Join Nostr
2026-06-04 20:25:16 UTC

ARGVMI~1.PIF on Nostr: So yeah, apparently the #Windows #Win32 function `CloseClipboard` doesn't actually ...

So yeah, apparently the #Windows #Win32 function `CloseClipboard` doesn't actually close the clipboard right away.

There is no guarantee that immediately calling `OpenClipboard` will succeed. Even on the same thread.

Which means mutex locking around `OpenClipboard`/`CloseClipboard` won't work. If there is contention, it'll still fail.

The docs say nothing about this. https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-closeclipboard

FML.

A strategy of “mutex lock, then sleep-and-retry a few times” seems to suffice…

#programming