ref: fec0afc4afe517c6c18ee083a1f2778110c8e539
parent: 047f801553d7a10762df6150c394456202593432
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Tue Jul 15 16:45:00 EDT 2014
page: fix deadlock with addpage (thanks BurnZeZ for the stacktraces) addpage() should not be called with the display locked as it calls showpage1() which sleeps when there are too many processes active. the bug was triggered by plumbing to trigger the addpage().
--- a/sys/src/cmd/page.c
+++ b/sys/src/cmd/page.c
@@ -1681,7 +1681,6 @@
ground = allocimage(display, Rect(0,0,1,1), screen->chan, 1, 0x777777FF);
display->locking = 1;
unlockdisplay(display);
- drawlock(1);
einit(Ekeyboard|Emouse);
eplumb(Eplumb, "image");
@@ -1698,6 +1697,7 @@
for(; *argv; argv++)
addpage(root, *argv, popenfile, strdup(*argv), -1);
+ drawlock(1);
for(;;){drawlock(0);
i=event(&e);
@@ -1802,7 +1802,9 @@
j = trywalk(s, plumblookup(pm->attr, "addr"));
if(j == nil){current = root;
+ drawlock(0);
j = addpage(root, s, popenfile, s, fd);
+ drawlock(1);
}
showpage(j);
}
--
⑨