commit 2e2d10eca6f07da02f3778afc9dd5bc3c8ff05e9
parent e22dab03910d62114fc76b0192f1af662f01743f
Author: bakkeby <bakkeby@gmail.com>
Date: Tue, 24 Mar 2020 15:37:28 +0100
x: check we still have an XIC context before accessing it (ce060a)
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/x.c b/x.c
@@ -1009,6 +1009,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);
}
@@ -2050,13 +2051,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);