diff options
author | glenda <glenda@cirno> | 2011-10-02 23:14:14 +0200 |
---|---|---|
committer | glenda <glenda@cirno> | 2011-10-02 23:14:14 +0200 |
commit | da4d5c9c2174c6890b6494d208adf36f24bdaf6e (patch) | |
tree | 1d226442fcfccbdbc725d708fbdadd345de9fd51 /sys/src/libthread/note.c | |
parent | b8d741d34b4130afabe5467a0d9e0e3d57e6c765 (diff) |
libdraw: shutdown keyboard and mouseprocs with threadint, libthread: avoid delayed note leak (this fixes the "too many delayed notes" error with auth/fgui)
Diffstat (limited to 'sys/src/libthread/note.c')
-rw-r--r-- | sys/src/libthread/note.c | 9 |
1 files changed, 6 insertions, 3 deletions
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; n<enotes; n++){ if(n->proc == p){ + strcpy(s, n->s); + n->proc = nil; + unlock(&n->inuse); + for(i=0; i<NFN; i++){ if(onnotepid[i]!=p->pid || (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); } } } |