Commit b894925b authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

winex11.drv: Make sure that the selectionAcquired flag has been set before…

winex11.drv: Make sure that the selectionAcquired flag has been set before returning from X11DRV_AcquireClipboard. X11DRV_CLIPBOARD_UpdateCache depends on selectionAcquired being set if the current process is the selection owner, otherwise it will defer to getting the clipformats from X, manufacturing extra formats that the app may not be expecting, having just set the formats itself. Worse still, since selectionAcquired is set in another thread this behaviour is not predicatable and it may sometimes use the clipformats already set and other times defer to X.
parent 0d10ddd4
...@@ -2653,9 +2653,14 @@ static void selection_acquire(void) ...@@ -2653,9 +2653,14 @@ static void selection_acquire(void)
} }
} }
static DWORD WINAPI selection_thread_proc(LPVOID unused) static DWORD WINAPI selection_thread_proc(LPVOID p)
{ {
HANDLE event = p;
TRACE("\n");
selection_acquire(); selection_acquire();
SetEvent(event);
while (selectionAcquired) while (selectionAcquired)
{ {
...@@ -2705,7 +2710,8 @@ int CDECL X11DRV_AcquireClipboard(HWND hWndClipWindow) ...@@ -2705,7 +2710,8 @@ int CDECL X11DRV_AcquireClipboard(HWND hWndClipWindow)
} }
else else
{ {
selectionThread = CreateThread(NULL, 0, &selection_thread_proc, NULL, 0, NULL); HANDLE event = CreateEventW(NULL, FALSE, FALSE, NULL);
selectionThread = CreateThread(NULL, 0, &selection_thread_proc, event, 0, NULL);
if (!selectionThread) if (!selectionThread)
{ {
...@@ -2713,6 +2719,8 @@ int CDECL X11DRV_AcquireClipboard(HWND hWndClipWindow) ...@@ -2713,6 +2719,8 @@ int CDECL X11DRV_AcquireClipboard(HWND hWndClipWindow)
return 0; return 0;
} }
WaitForSingleObject(event, INFINITE);
CloseHandle(event);
CloseHandle(selectionThread); CloseHandle(selectionThread);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment