From 1e3484f2017f038dd5149cd50741feaf39a680e4 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Thu, 9 Feb 2023 11:30:37 +0100 Subject: [PATCH] Sanity check when cleaning up keymap changes Make sure we don't send a bogus request to the X server in the (common) case that we don't actually have anything to restore. --- unix/x0vncserver/XDesktop.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/unix/x0vncserver/XDesktop.cxx b/unix/x0vncserver/XDesktop.cxx index 5f5366b7..19517929 100644 --- a/unix/x0vncserver/XDesktop.cxx +++ b/unix/x0vncserver/XDesktop.cxx @@ -481,6 +481,10 @@ void XDesktop::deleteAddedKeysyms(Display* dpy) { } } + // Did we actually find something to remove? + if (highestKeyCode < lowestKeyCode) + return; + changes.changed |= XkbKeySymsMask; changes.first_key_sym = lowestKeyCode; changes.num_key_syms = highestKeyCode - lowestKeyCode + 1; -- 2.39.5