Commit 20353e96 authored by Ulrich Sibiller's avatar Ulrich Sibiller

libNX_X11: add additional checks for dpy and xkb

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
parent 4df77fe7
...@@ -108,7 +108,21 @@ XKeycodeToKeysym(Display *dpy, ...@@ -108,7 +108,21 @@ XKeycodeToKeysym(Display *dpy,
_XkbCheckPendingRefresh(dpy, dpy->xkb_info); _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; 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)) if ((kc < xkb->min_key_code) || (kc > xkb->max_key_code))
return NoSymbol; return NoSymbol;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment