summaryrefslogtreecommitdiff
path: root/hw/xwin/winclipboardthread.c
diff options
context:
space:
mode:
authorColin Harrison <colin.harrison@virgin.net>2009-02-03 15:57:29 +0000
committerJon TURNEY <jon.turney@dronecode.org.uk>2009-02-12 12:07:30 +0000
commitd7c27bfe553235e55eb48799129ff9f8e7e0d4f6 (patch)
tree84540d2fb3684c799a7cbb7eaa47d1abc1bc5395 /hw/xwin/winclipboardthread.c
parentcb6315072ff23740bdc5fc2f95dd960601df5664 (diff)
Xming: Check clipboard selection ownership after taking it
When you take ownership of a selection you should always check you got it (X11 ICCCM gospel). Copyright (C) Colin Harrison 2005-2008 http://www.straightrunning.com/XmingNotes/ http://sourceforge.net/projects/xming/ Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Diffstat (limited to 'hw/xwin/winclipboardthread.c')
-rw-r--r--hw/xwin/winclipboardthread.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/hw/xwin/winclipboardthread.c b/hw/xwin/winclipboardthread.c
index c1e8e131c..9040f400c 100644
--- a/hw/xwin/winclipboardthread.c
+++ b/hw/xwin/winclipboardthread.c
@@ -273,7 +273,8 @@ winClipboardProc (void *pvNotUsed)
/* PRIMARY */
iReturn = XSetSelectionOwner (pDisplay, XA_PRIMARY,
iWindow, CurrentTime);
- if (iReturn == BadAtom || iReturn == BadWindow)
+ if (iReturn == BadAtom || iReturn == BadWindow ||
+ XGetSelectionOwner (pDisplay, XA_PRIMARY) != iWindow)
{
ErrorF ("winClipboardProc - Could not set PRIMARY owner\n");
pthread_exit (NULL);
@@ -282,7 +283,8 @@ winClipboardProc (void *pvNotUsed)
/* CLIPBOARD */
iReturn = XSetSelectionOwner (pDisplay, atomClipboard,
iWindow, CurrentTime);
- if (iReturn == BadAtom || iReturn == BadWindow)
+ if (iReturn == BadAtom || iReturn == BadWindow ||
+ XGetSelectionOwner (pDisplay, atomClipboard) != iWindow)
{
ErrorF ("winClipboardProc - Could not set CLIPBOARD owner\n");
pthread_exit (NULL);