[X2Go-Commits] [nx-libs] 312/429: Clipboard.c: improve error message

git-admin at x2go.org git-admin at x2go.org
Mon Oct 18 09:36:55 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 18c91fd94c8bba7de44110e9db9daf41ee6f916d
Author: Ulrich Sibiller <uli42 at gmx.de>
Date:   Fri Oct 2 22:59:12 2020 +0200

    Clipboard.c: improve error message
    
    if we get an unexpected property print that as an error. Before we saw
    "unexpected stage" in that case which does not really help in
    debugging...
---
 nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 57 +++++++++++++++++---------
 1 file changed, 37 insertions(+), 20 deletions(-)

diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
index bb8ca5843..f704e4702 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
@@ -1330,8 +1330,8 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X)
   }
 
   #ifdef DEBUG
+  XSelectionEvent * e = (XSelectionEvent *)X;
   {
-    XSelectionEvent * e = (XSelectionEvent *)X;
     char * s = XGetAtomName(nxagentDisplay, e->property);
     char * t = XGetAtomName(nxagentDisplay, e->target);
     fprintf(stderr, "%s: SelectionNotify event from real X server, property "\
@@ -1355,29 +1355,46 @@ void nxagentHandleSelectionNotifyFromXServer(XEvent *X)
      * the real X server). We now need to transfer it to the original
      * requestor, which is stored in the lastClient* variables.
      */
-    if (lastClientStage == SelectionStageNone &&
-	     X->xselection.property == serverTransToAgentProperty)
+
+    #ifdef DEBUG
+    fprintf(stderr, "%s: event selection is [%s]\n", __func__, XGetAtomName(nxagentDisplay, e->selection));
+    nxagentDumpClipboardStat();
+    #endif
+    if (lastClientStage == SelectionStageNone)
     {
-      #ifdef DEBUG
-      fprintf(stderr, "%s: Starting selection transferral for client %s.\n", __func__,
-                  nxagentClientInfoString(lastClientClientPtr));
-      #endif
+      if (X->xselection.property == serverTransToAgentProperty)
+      {
+        #ifdef DEBUG
+        fprintf(stderr, "%s: Starting selection transferral for client %s.\n", __func__,
+                nxagentClientInfoString(lastClientClientPtr));
+        #endif
 
-      /*
-       * The state machine is able to work in two phases. In the first
-       * phase we get the size of property data, in the second we get
-       * the actual data. We save a round-trip by requesting a prede-
-       * termined amount of data in a single GetProperty and by discar-
-       * ding the remaining part. This is not the optimal solution (we
-       * could get the remaining part if it doesn't fit in a single
-       * reply) but, at least with text, it should work in most situa-
-       * tions.
-       */
+        /*
+         * The state machine is able to work in two phases. In the first
+         * phase we get the size of property data, in the second we get
+         * the actual data. We save a round-trip by requesting a prede-
+         * termined amount of data in a single GetProperty and by discar-
+         * ding the remaining part. This is not the optimal solution (we
+         * could get the remaining part if it doesn't fit in a single
+         * reply) but, at least with text, it should work in most situa-
+         * tions.
+         */
 
-      setClientSelectionStage(SelectionStageQueryData);
-      lastClientPropertySize = 262144;
+        setClientSelectionStage(SelectionStageQueryData);
+        lastClientPropertySize = 262144;
 
-      transferSelection(lastClientClientPtr -> index);
+        transferSelection(lastClientClientPtr -> index);
+      }
+      else
+      {
+        #ifdef DEBUG
+        char *s = XGetAtomName(nxagentDisplay, X->xselection.property);
+        fprintf(stderr, "%s: Unexpected property [%ld][%s] - reporting conversion failure.\n",
+                    __func__, X->xselection.property, s);
+        SAFE_XFree(s);
+        #endif
+        endTransfer(SELECTION_FAULT);
+      }
     }
     else
     {

--
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