https://bugs.winehq.org/show_bug.cgi?id=51234
Bug ID: 51234 Summary: user32:clipboard test_ClipboardOwner() has a race condition with clipboard managers Product: Wine Version: 6.8 Hardware: x86-64 OS: Linux Status: NEW Severity: normal Priority: P2 Component: user32 Assignee: wine-bugs@winehq.org Reporter: fgouget@codeweavers.com Distribution: ---
test_ClipboardOwner() has a race condition with clipboard managers that causes this set of failures:
clipboard.c:404: Test failed: SetClipboardData succeeded clipboard.c:406: Test failed: wrong error 3735928559 clipboard.c:407: Test failed: SetClipboardData succeeded
Fortunately(?) this failure is pretty rare.
What happens is this:
* test_ClipboardOwner() does this: OpenClibpoard(NULL) EmptyClipboard() // take ownership CloseClipboard()
* Then the clipboard manager starts checking the content of the clipboard: OpenClipboard(manager_hwnd) ...
* And then the next test_ClipboardOwner() test happens: SetClipboardData(CF_WAVE, ...) ok(GetLastError() == ERROR_CLIPBOARD_NOT_OPEN, ...) ok(!IsClipboardFormatAvailable(CF_WAVE), ...
Because test_ClipboardOwner() opened the clipboard with a NULL windows handle, EmptyClipboard() used that as the clipboard owner. But when the owner is NULL a process can place data in the clipboard as long as any process opened it. This is actually the whole point of the run_process("set_clipboard_data 4") test.
So the problem is that user32:clipboard assumes that no other process is going to open the clipboard after it called CloseClipboard(). Yet that's precisely when clipboard manager would receive a WM_CLIPBOARDUPDATE message and open it.
https://bugs.winehq.org/show_bug.cgi?id=51234
François Gouget fgouget@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |source, testcase
https://bugs.winehq.org/show_bug.cgi?id=51234
François Gouget fgouget@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |a2f2b73ca42e564700bf00fee2a | |dfd76346daadd Status|NEW |RESOLVED Resolution|--- |FIXED
--- Comment #1 from François Gouget fgouget@codeweavers.com --- This got fixed by the commit below:
commit a2f2b73ca42e564700bf00fee2adfd76346daadd Author: François Gouget fgouget@codeweavers.com AuthorDate: Tue Jun 8 00:21:47 2021 +0200 Commit: François Gouget fgouget@free.fr CommitDate: Sat Nov 26 05:30:17 2022 +0100
user32/tests: Fix a clipboard manager race condition in test_ClipboardOwner().
When the clipboard owner is NULL, SetClipboardData() succeeds as soon as any process has the clipboard open, even if it's a clipboard manager.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51234 Signed-off-by: Francois Gouget fgouget@codeweavers.com
https://bugs.winehq.org/show_bug.cgi?id=51234
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #2 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 8.0-rc1.
https://bugs.winehq.org/show_bug.cgi?id=51234
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |mstefani@winehq.org
--- Comment #3 from Michael Stefaniuc mstefani@winehq.org --- I don't see a2f2b73ca42e564700bf00fee2adfd76346daadd in origin/master. And the only commit matching test_ClipboardOwner is: commit 91a791e5177ac4a529f83262feb973371f1c2d20 Author: François Gouget fgouget@codeweavers.com Date: Thu Jun 10 12:10:46 2021 +0200
user32/tests: Preserve the initial GetLastError() value for test_ClipboardOwner().
Was the commit a2f2b73ca42e564700bf00fee2adfd76346daadd even merged?
https://bugs.winehq.org/show_bug.cgi?id=51234
--- Comment #4 from François Gouget fgouget@codeweavers.com --- Created attachment 73849 --> https://bugs.winehq.org/attachment.cgi?id=73849 Fix a clipboard manager race condition in test_ClipboardOwner().
https://bugs.winehq.org/show_bug.cgi?id=51234
François Gouget fgouget@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|FIXED |WORKSFORME Fixed by SHA1|a2f2b73ca42e564700bf00fee2a | |dfd76346daadd |
--- Comment #5 from François Gouget fgouget@codeweavers.com --- Sorry, a2f2b73ca42e has not been committed (it's in my tree, I attached it here for reference). Still I don't see these failures in the WineTest results anymore, not even on my box where KDE is causing me grief. So changing the status to "works for me".
Please reopen if you're running into these failures.
https://bugs.winehq.org/show_bug.cgi?id=51234
--- Comment #6 from Michael Stefaniuc mstefani@winehq.org --- I don't experience the issue. My Stable scripts couldn't find the commit id and complained.