Rob Shearman : winex11.drv: Make sure that the selectionAcquired flag has been set before returning from X11DRV_AcquireClipboard .
Alexandre Julliard
julliard at winehq.org
Tue Dec 1 09:19:44 CST 2009
Module: wine
Branch: master
Commit: b894925b0ef54007957e21dcfa7df01307a75285
URL: http://source.winehq.org/git/wine.git/?a=commit;h=b894925b0ef54007957e21dcfa7df01307a75285
Author: Rob Shearman <robertshearman at gmail.com>
Date: Tue Dec 1 13:16:20 2009 +0000
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.
---
dlls/winex11.drv/clipboard.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/dlls/winex11.drv/clipboard.c b/dlls/winex11.drv/clipboard.c
index 2740264..3d9c153 100644
--- a/dlls/winex11.drv/clipboard.c
+++ b/dlls/winex11.drv/clipboard.c
@@ -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);
}
More information about the wine-cvs
mailing list