ref: 954f906c3b2f09299f7e6ee5dfefc2ae466e477a
parent: 80044f90536a2ed1a7bf2245b1ec51fb41642122
author: Ori Bernstein <ori@eigenstate.org>
date: Thu Nov 5 20:47:32 EST 2020
use 'delete' to force window deletion in winclose if we call winclose() and exit the thread, we can never close the window again due to 'Del' being left uninterpreted.
--- a/win.c
+++ b/win.c
@@ -128,7 +128,6 @@
{
char buf[12];
- w->io = ioproc();
w->ctl = open("/mnt/wsys/new/ctl", ORDWR|OCEXEC);
if(w->ctl < 0)
sysfatal("winopen: %r");
@@ -138,17 +137,20 @@
sysfatal("write ctl: %r");
if(fprint(w->ctl, "noscroll\n") == -1)
sysfatal("write ctl: %r");
+ w->io = ioproc();
w->id = atoi(buf);
w->event = bwinopen(w, "event", OREAD);
w->revent = winopen(w, "event", OWRITE);
w->addr = winopen(w, "addr", ORDWR);
w->data = winopen(w, "data", ORDWR);
+ w->open = 1;
}
void
winclose(Win *w)
{
- fprint(w->ctl, "del\n");
+ if(w->open)
+ fprint(w->ctl, "delete\n");
if(w->data != -1)
close(w->data);
if(w->addr != -1)