[X2Go-Commits] [nx-libs] 326/429: Clipboard.c: fix nxagentConvertSelection

git-admin at x2go.org git-admin at x2go.org
Mon Oct 18 09:36:58 CEST 2021


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch 3.6.x
in repository nx-libs.

commit e526e1cd0fec37b35a746d600170e923e8e86041
Author: Ulrich Sibiller <uli42 at gmx.de>
Date:   Tue Sep 22 23:33:35 2020 +0200

    Clipboard.c: fix nxagentConvertSelection
    
    - debug output was not printed at the beginning but later and
      was therefore missing sometimes
    - add comments/FIXMEs
    - re-enable failure notification for second call
---
 nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 46 ++++++++++++++------------
 1 file changed, 24 insertions(+), 22 deletions(-)

diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
index 60792bb44..fe6d39281 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
@@ -1863,6 +1863,24 @@ FIXME
 int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection,
                                 Window requestor, Atom property, Atom target, Time time)
 {
+  const char *strTarget = NameForAtom(target);
+
+  #ifdef DEBUG
+  fprintf(stderr, "%s: client %s requests sel [%s] "
+              "on window [0x%x] prop [%d][%s] target [%d][%s].\n", __func__,
+                  nxagentClientInfoString(client), validateString(NameForAtom(selection)), requestor,
+                      property, validateString(NameForAtom(property)),
+                          target, validateString(strTarget));
+  #endif
+
+  if (strTarget == NULL)
+  {
+    #ifdef DEBUG
+    fprintf(stderr, "%s: cannot find name for target Atom [%d] - returning\n", __func__, target);
+    #endif
+    return 1;
+  }
+
   if (!agentClipboardInitialized)
   {
     #ifdef DEBUG
@@ -1915,20 +1933,22 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection,
     if ((GetTimeInMillis() - lastClients[index].reqTime) >= CONVERSION_TIMEOUT)
     {
       #ifdef DEBUG
-      fprintf(stderr, "%s: timeout expired on last request, "
+      fprintf(stderr, "%s: timeout expired on previous request, "
                   "notifying failure to client %s\n", __func__, nxagentClientInfoString(client));
       #endif
 
       /* notify the waiting client of failure */
       endTransfer(SELECTION_FAULT, index);
-      return 1;
+
+      /* do NOT return here but process the new request instead! */
     }
     else
     {
       /*
        * we got another convert request while already waiting for an
-       * answer from the real X server to a previous convert request,
-       * which we cannot handle (yet). So return an error.
+       * answer from the real X server to a previous convert request
+       * for this selection, which we cannot handle (yet). So return
+       * an error for the new request.
        */
       #ifdef DEBUG
       fprintf(stderr, "%s: got new request "
@@ -1943,24 +1963,6 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection,
     }
   }
 
-  const char *strTarget = NameForAtom(target);
-
-  #ifdef DEBUG
-  fprintf(stderr, "%s: client %s requests sel [%s] "
-              "on window [0x%x] prop [%d][%s] target [%d][%s].\n", __func__,
-                  nxagentClientInfoString(client), validateString(NameForAtom(selection)), requestor,
-                      property, validateString(NameForAtom(property)),
-                          target, validateString(strTarget));
-  #endif
-
-  if (strTarget == NULL)
-  {
-    #ifdef DEBUG
-    fprintf(stderr, "%s: cannot find name for target Atom [%d] - returning\n", __func__, target);
-    #endif
-    return 1;
-  }
-
   /*
    * The selection request target is TARGETS. The requestor is asking
    * for a list of supported data formats.

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/nx-libs.git


More information about the x2go-commits mailing list