protonscr

Wine Bug 59519: ole32 clipboard caches stale window handle — fix pending upstream

protonclosed
ValveSoftware/Proton#9787 · opened 2026-05-14 by ayourk · updated 2026-05-14 · 1 comments · github
1 matching comments, n / p to jump
Aayourk 2026-05-14 github

Summary

Wine's OLE clipboard implementation (dlls/ole32/clipboard.c) caches the HWND from get_clipbrd_window() in a static local. When the STA thread that created the window terminates, the cached handle goes stale. The next OleSetClipboard call reuses the dead handle, SendMessageW targets a destroyed window, and clipboard operations silently fail.

This affects any Proton game or application that creates and destroys STA threads with clipboard interaction (e.g. Space Engineers, AppID 244850).

Fix

A one-line IsWindow() guard before the cached-handle return in get_clipbrd_window(). If the cached window has been destroyed, the function falls through to the existing !clipbrd->window branch which creates a fresh one.

System Information

  • Proton version: Affects all versions (Wine-level bug)
  • GPU: EVGA GeForce RTX 3080 Ti
  • Video driver version: nvidia 575.64
  • Kernel version: 6.17.0-1014-nvidia

Impact — ProtonDB reports

Multiple users on ProtonDB for Space Engineers (244850) report this same clipboard bug across different Proton versions and distros:

  • TempleOS Compatibility Layer (3 weeks ago, GE-Proton10-32): "The game freezes for a second when I try to copy any string to the clipboard, both from Ctrl+C and from the 'Copy to clipboard' button, and the string isn't copied."
  • TroLLeX_ (1 week ago, proton-cachyos-10): "Clipboard is not working in the base game... Clipboard bug has been mentioned since all the way back in 2019, but community has fixed it."
  • Frans de Gans (8 months ago, GE-Proton10-10): "Copying(&paste) can Freeze the game for a good minute." (listed as significant bug)

The community has been working around this with the Pulsar Plugin Loader + CosmicWineFixes plugin, but Pulsar is not allowed on official servers, making this workaround unavailable for multiplayer. The root cause is in Wine itself.

Reproduction

A standalone reproducer is attached to the Wine bug report (attachment 80543). It spawns an STA thread that calls OleSetClipboard, exits the thread, then calls OleSetClipboard again from the main thread — the second call fails with the stale handle.

Why file here

The fix is pending upstream Wine review. Filing here for visibility so the Proton team is aware and can cherry-pick if desired before the MR lands in mainline Wine.

Kkisak-valve maintainer 2026-05-14 github

Hello @ayourk, there's nothing to ponder here until after the change is reviewed and merged upstream. After that's happened, then add a note to the compatibility report for the game and a Proton dev can consider backporting the change into Proton.

Proton versions

Upstream links