diff options
author | Ulrich Sibiller <uli42@gmx.de> | 2021-01-30 19:07:43 +0100 |
---|---|---|
committer | Ulrich Sibiller <uli42@gmx.de> | 2021-06-20 20:12:51 +0200 |
commit | d335fc8fb04e1611352842b6f6d68f3fe43d44e9 (patch) | |
tree | 5d4f7e4648b173bad2dc6bb0c3999b24ce50339b /nx-X11/programs/Xserver | |
parent | 9d8771562c847e957250f7df7411b9ce92dd1143 (diff) | |
download | nx-libs-d335fc8fb04e1611352842b6f6d68f3fe43d44e9.tar.gz nx-libs-d335fc8fb04e1611352842b6f6d68f3fe43d44e9.tar.bz2 nx-libs-d335fc8fb04e1611352842b6f6d68f3fe43d44e9.zip |
Clipboard.c: do not handle unknown selections in Callback handler
Diffstat (limited to 'nx-X11/programs/Xserver')
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 19 |
1 files 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); |