commit cd785755f2e3e3305c7d2556a04423a40bce060a from: Quentin Rameau via: Hiltjo Posthuma date: Sun Feb 2 21:56:51 2020 UTC x: check we still have an XIC context before accessing it commit - 2cb539142b97bd2a5c1a322fd7c063c6afb67c9b commit + cd785755f2e3e3305c7d2556a04423a40bce060a blob - 5af6e4ddbb5c9e57d3b8e591e7e7c270b7ecba66 blob + b4886177273fd308baa2e86de1db8eb00b64e7a9 --- x.c +++ x.c @@ -1061,6 +1061,7 @@ void ximdestroy(XIM xim, XPointer client, XPointer call) { xw.ime.xim = NULL; + xw.ime.xic = NULL; XRegisterIMInstantiateCallback(xw.dpy, NULL, NULL, NULL, ximinstantiate, NULL); XFree(xw.ime.spotlist); @@ -1692,13 +1693,15 @@ focus(XEvent *ev) return; if (ev->type == FocusIn) { - XSetICFocus(xw.ime.xic); + if (xw.ime.xic) + XSetICFocus(xw.ime.xic); win.mode |= MODE_FOCUSED; xseturgency(0); if (IS_SET(MODE_FOCUS)) ttywrite("\033[I", 3, 0); } else { - XUnsetICFocus(xw.ime.xic); + if (xw.ime.xic) + XUnsetICFocus(xw.ime.xic); win.mode &= ~MODE_FOCUSED; if (IS_SET(MODE_FOCUS)) ttywrite("\033[O", 3, 0);