aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Clipboard.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
index 4a0bf9cb5..3b08c1133 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
@@ -882,6 +882,14 @@ void nxagentHandleSelectionClearFromXServerByIndex(int index)
fprintf(stderr, "%s: SelectionClear event for selection index [%u].\n", __func__, index);
#endif
+ if (index == -1)
+ {
+ #ifdef DEBUG
+ fprintf(stderr, "%s: ignoring index -1 - doing nothing.\n", __func__);
+ #endif
+ return;
+ }
+
if (!agentClipboardInitialized)
{
#ifdef DEBUG
@@ -931,11 +939,7 @@ void nxagentHandleSelectionClearFromXServerByAtom(XlibAtom sel)
fprintf(stderr, "---------\n%s: SelectionClear event for remote selection atom [%lu][%s].\n", __func__, sel, NameForRemoteAtom(sel));
#endif
- int index = nxagentFindRemoteSelectionIndex(sel);
- if (index != -1)
- {
- nxagentHandleSelectionClearFromXServerByIndex(index);
- }
+ nxagentHandleSelectionClearFromXServerByIndex(nxagentFindRemoteSelectionIndex(sel));
}
void nxagentHandleSelectionClearFromXServer(XEvent *X)