From 2cd313668cea156fd13b54873d7934d9b15d8081 Mon Sep 17 00:00:00 2001 From: Jacob Moody Date: Wed, 19 Oct 2022 03:00:04 +0000 Subject: 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. --- sys/src/cmd/rio/rio.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'sys/src/cmd') 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); -- cgit v1.2.3