Xinqi Bao's Git
projects
/
st.git
/ commitdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
patch
|
inline
| side by side (from parent 1:
2cb5391
)
x: check we still have an XIC context before accessing it
author
Quentin Rameau <
[email protected]
>
Sun, 2 Feb 2020 16:38:36 +0000
(17:38 +0100)
committer
Hiltjo Posthuma <
[email protected]
>
Sun, 2 Feb 2020 21:56:51 +0000
(22:56 +0100)
x.c
patch
|
blob
|
history
diff --git
a/x.c
b/x.c
index
5af6e4d
..
b488617
100644
(file)
--- a/
x.c
+++ b/
x.c
@@
-1061,6
+1061,7
@@
void
ximdestroy(XIM xim, XPointer client, XPointer call)
{
xw.ime.xim = NULL;
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);
XRegisterIMInstantiateCallback(xw.dpy, NULL, NULL, NULL,
ximinstantiate, NULL);
XFree(xw.ime.spotlist);
@@
-1692,13
+1693,15
@@
focus(XEvent *ev)
return;
if (ev->type == FocusIn) {
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 {
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);
win.mode &= ~MODE_FOCUSED;
if (IS_SET(MODE_FOCUS))
ttywrite("\033[O", 3, 0);