winex11.drv: Report failure when we can't convert a selection.

Vincent Povirk madewokherd at gmail.com
Fri May 1 15:21:08 CDT 2015


ICCCM says the owner should set the property on SelectionNotify to
None when a selection can't be converted.

This fixes a bug where, if a Wine process empties the clipboard, and
another Wine process calls EnumClipboardFormats, the process calling
EnumClipboardFormats will get a list of text formats instead of an
empty list.
-------------- next part --------------
From 7f825eb6222f196f89b6284098ffa4df7d24f2f2 Mon Sep 17 00:00:00 2001
From: Vincent Povirk <vincent at codeweavers.com>
Date: Fri, 1 May 2015 15:05:11 -0500
Subject: [PATCH] winex11.drv: Report failure when we can't convert a
 selection.

---
 dlls/winex11.drv/clipboard.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/dlls/winex11.drv/clipboard.c b/dlls/winex11.drv/clipboard.c
index dad4a7a..5816d87 100644
--- a/dlls/winex11.drv/clipboard.c
+++ b/dlls/winex11.drv/clipboard.c
@@ -3506,6 +3506,7 @@ static void X11DRV_HandleSelectionRequest( HWND hWnd, XSelectionRequestEvent *ev
     else
     {
         LPWINE_CLIPFORMAT lpFormat = X11DRV_CLIPBOARD_LookupProperty(NULL, event->target);
+        BOOL success=FALSE;
 
         if (lpFormat && lpFormat->lpDrvExportFunc)
         {
@@ -3536,9 +3537,14 @@ static void X11DRV_HandleSelectionRequest( HWND hWnd, XSelectionRequestEvent *ev
 
                     GlobalUnlock(hClipData);
                     GlobalFree(hClipData);
+                    success = TRUE;
                 }
             }
         }
+
+        if (!success)
+            // Report failure to client.
+            rprop = None;
     }
 
 END:
-- 
2.1.4



More information about the wine-patches mailing list