libdraw: shutdown keyboard and mouseprocs with threadint, libthread: avoid delayed note leak (this fixes the "too many delayed notes" error with auth/fgui)

This commit is contained in:
glenda 2011-10-02 23:14:14 +02:00
parent b8d741d34b
commit da4d5c9c21
3 changed files with 34 additions and 50 deletions

View file

@ -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);
}
}
}