summaryrefslogtreecommitdiff
path: root/sys/src/cmd
diff options
context:
space:
mode:
authorJacob Moody <moody@posixcafe.org>2022-10-19 03:00:04 +0000
committerJacob Moody <moody@posixcafe.org>2022-10-19 03:00:04 +0000
commit2cd313668cea156fd13b54873d7934d9b15d8081 (patch)
tree514d61709e5e8f3b6825dec3b4097b14726da622 /sys/src/cmd
parent676f990fbbe3bb4e245a79ce665fdf9f55ffd3cc (diff)
rio: prevent some more keyboard lockups
Triggered these from ktrans a couple times when poking at it, the issue is that we get stuck wanting to emit to the tap without a valid listener. This ensures we are never stuch sending to a deleted window or dead tap user.
Diffstat (limited to 'sys/src/cmd')
-rw-r--r--sys/src/cmd/rio/rio.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/src/cmd/rio/rio.c b/sys/src/cmd/rio/rio.c
index 2caf06908..322076f8c 100644
--- a/sys/src/cmd/rio/rio.c
+++ b/sys/src/cmd/rio/rio.c
@@ -389,6 +389,7 @@ void
keyboardtap(void*)
{
char *s, *ctl;
+ char *e;
char *watched;
Window *w, *cur;
@@ -414,7 +415,7 @@ keyboardtap(void*)
if(cur != nil){
alts[Ainp].c = cur->ck;
if(tapseats[OREAD] == Tapoff)
- break;
+ goto Reset;
if(alts[Awatch].op == CHANSND)
free(watched);
watched = smprint("%c%d", Tapfocus, cur->id);
@@ -424,9 +425,14 @@ keyboardtap(void*)
free(s);
goto Reset;
case Actl:
- sendp(resptap, tapctlmsg(ctl));
+ e = tapctlmsg(ctl);
+ sendp(resptap, e);
+ if(e != nil || *ctl != Tapoff){
+ free(ctl);
+ break;
+ }
free(ctl);
- break;
+ goto Reset;
case Afrom:
if(cur == nil){
free(s);