aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2019-05-15 19:54:24 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2019-05-17 15:54:26 +0200
commit2911a2388ee97fa3ac80fda2fd7b9633d1bf3ac3 (patch)
treed965b27ce852bd7262c26459815d457f6bf5a2bf
parent148eda36d486c0af019267a644c08d5e8c2f4f8b (diff)
downloadnx-libs-pr/fix_xkb_crash.tar.gz
nx-libs-pr/fix_xkb_crash.tar.bz2
nx-libs-pr/fix_xkb_crash.zip
libNX_X11: add additional checks for dpy and xkbpr/fix_xkb_crash
We have seen crashes during session shutdown/connection problems here. These patches should avoid them. There's no proper way to test them, but they should do no harm.. Fixes ArcticaProject/nx-libs#801 Fixes https://bugs.x2go.org/cgi-bin/bugreport.cgi?bug=695
-rw-r--r--nx-X11/lib/src/xkb/XKBBind.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/nx-X11/lib/src/xkb/XKBBind.c b/nx-X11/lib/src/xkb/XKBBind.c
index 068e8f2a0..ffe5ad9d7 100644
--- a/nx-X11/lib/src/xkb/XKBBind.c
+++ b/nx-X11/lib/src/xkb/XKBBind.c
@@ -108,7 +108,21 @@ XKeycodeToKeysym(Display *dpy,
_XkbCheckPendingRefresh(dpy, dpy->xkb_info);
+#ifdef NX_TRANS_SOCKET
+ /*
+ check again, we have seen cases where the connection broke
+ during CheckPendingEvents(), followed by a crash when accessing
+ dpy. See https://github.com/ArcticaProject/nx-libs/issues/801
+ */
+ if (_XkbUnavailable(dpy))
+ return _XKeycodeToKeysym(dpy, kc, col);
+#endif
+
xkb = dpy->xkb_info->desc;
+#ifdef NX_TRANS_SOCKET
+ if (xkb == NULL)
+ return _XKeycodeToKeysym(dpy, kc, col);
+#endif
if ((kc < xkb->min_key_code) || (kc > xkb->max_key_code))
return NoSymbol;