[X2Go-Commits] [nx-libs] 382/429: Clipboard.c: do not handle unknown selections in Callback handler

git-admin at x2go.org git-admin at x2go.org
Mon Oct 18 09:37:12 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 d335fc8fb04e1611352842b6f6d68f3fe43d44e9
Author: Ulrich Sibiller <uli42 at gmx.de>
Date:   Sat Jan 30 19:07:43 2021 +0100

    Clipboard.c: do not handle unknown selections in Callback handler
---
 nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
index b3598eef8..b77cb181a 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
@@ -2108,11 +2108,23 @@ void nxagentSetSelectionCallback(CallbackListPtr *callbacks, void *data,
   }
   #endif
 
+  Selection * pCurSel = (Selection *)info->selection;
+
+  int index = nxagentFindCurrentSelectionIndex(pCurSel->selection);
+  if (index == -1)
+  {
+    #ifdef DEBUG
+    fprintf(stderr, "%s: selection [%s] will not be handled by the clipboard code\n", __func__, NameForIntAtom(pCurSel->selection));
+    #endif
+    return;
+  }
+
   /*
-   * We do not know index here so for now let's invalidate the
-   * complete cache on every owner change regardless of the selection.
+   * always invalidate the target cache for the relevant selection,
+   * even if the trap is set. This ensures not having invalid data in
+   * the cache.
    */
-  invalidateTargetCaches();
+  invalidateTargetCache(index);
 
   if (nxagentExternalClipboardEventTrap)
   {
@@ -2122,7 +2134,6 @@ void nxagentSetSelectionCallback(CallbackListPtr *callbacks, void *data,
     return;
   }
 
-  Selection * pCurSel = (Selection *)info->selection;
 
   #ifdef DEBUG
   fprintf(stderr, "%s: pCurSel->lastTimeChanged [%u]\n", __func__, pCurSel->lastTimeChanged.milliseconds);

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