From da4d5c9c2174c6890b6494d208adf36f24bdaf6e Mon Sep 17 00:00:00 2001 From: glenda Date: Sun, 2 Oct 2011 23:14:14 +0200 Subject: libdraw: shutdown keyboard and mouseprocs with threadint, libthread: avoid delayed note leak (this fixes the "too many delayed notes" error with auth/fgui) --- sys/src/libthread/note.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'sys/src/libthread/note.c') diff --git a/sys/src/libthread/note.c b/sys/src/libthread/note.c index 74f7e9013..c04e3e1a2 100644 --- a/sys/src/libthread/note.c +++ b/sys/src/libthread/note.c @@ -52,6 +52,7 @@ delayednotes(Proc *p, void *v) { int i; Note *n; + char s[ERRMAX]; int (*fn)(void*, char*); if(!p->pending) @@ -60,10 +61,14 @@ delayednotes(Proc *p, void *v) p->pending = 0; for(n=notes; nproc == p){ + strcpy(s, n->s); + n->proc = nil; + unlock(&n->inuse); + for(i=0; ipid || (fn = onnote[i])==nil) continue; - if((*fn)(v, n->s)) + if((*fn)(v, s)) break; } if(i==NFN){ @@ -74,8 +79,6 @@ delayednotes(Proc *p, void *v) abort(); threadexitsall(n->s); } - n->proc = nil; - unlock(&n->inuse); } } } -- cgit v1.2.3