diff options
author | Quentin Rameau <quinq@fifth.space> | 2020-02-02 17:38:36 +0100 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2020-02-02 22:56:51 +0100 |
commit | cd785755f2e3e3305c7d2556a04423a40bce060a (patch) | |
tree | c8af8d67da007dbfe1e59423cfc556f914547d99 /x.c | |
parent | 2cb539142b97bd2a5c1a322fd7c063c6afb67c9b (diff) | |
download | st-cd785755f2e3e3305c7d2556a04423a40bce060a.tar.gz st-cd785755f2e3e3305c7d2556a04423a40bce060a.tar.bz2 st-cd785755f2e3e3305c7d2556a04423a40bce060a.zip |
x: check we still have an XIC context before accessing it
Diffstat (limited to 'x.c')
-rw-r--r-- | x.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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); |