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.
This commit is contained in:
parent
0d10ddd4d5
commit
b894925b0e
|
@ -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();
|
||||
SetEvent(event);
|
||||
|
||||
while (selectionAcquired)
|
||||
{
|
||||
|
@ -2705,7 +2710,8 @@ int CDECL X11DRV_AcquireClipboard(HWND hWndClipWindow)
|
|||
}
|
||||
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)
|
||||
{
|
||||
|
@ -2713,6 +2719,8 @@ int CDECL X11DRV_AcquireClipboard(HWND hWndClipWindow)
|
|||
return 0;
|
||||
}
|
||||
|
||||
WaitForSingleObject(event, INFINITE);
|
||||
CloseHandle(event);
|
||||
CloseHandle(selectionThread);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue