shithub: drawterm

Download patch

ref: 60e52edbdea4e18d7fd0b409d49aa47327b2ee59
parent: 5f606aa3a211c2caee8d05299674a82963583474
author: Jacob Moody <moody@posixcafe.org>
date: Wed Aug 17 05:27:30 EDT 2022

Revert "tidy drawlock use"

This is a bug in the upstream 9front code, a fix is in the works
but best not to diverge.

--- a/kern/devdraw.c
+++ b/kern/devdraw.c
@@ -940,7 +940,7 @@
 	return di;
 }
 
-int
+static int
 initscreenimage(void)
 {
 	if(screenimage != nil)
@@ -956,8 +956,9 @@
 }
 
 void
-_deletescreenimage(void)
+deletescreenimage(void)
 {
+	dlock();
 	if(screenimage){
 		/* will be freed via screendimage; disable */
 		screenimage->clipr = ZR;
@@ -967,13 +968,6 @@
 		drawfreedimage(screendimage);
 		screendimage = nil;
 	}
-}
-
-void
-deletescreenimage(void)
-{
-	dlock();
-	_deletescreenimage();
 	dunlock();
 }
 
@@ -1002,6 +996,8 @@
 static Walkqid*
 drawwalk(Chan *c, Chan *nc, char **name, int nname)
 {
+	if(screenimage == nil)
+		error("no frame buffer");
 	return devwalk(c, nc, name, nname, 0, 0, drawgen);
 }
 
--- a/kern/term.c
+++ b/kern/term.c
@@ -9,8 +9,6 @@
 #include	"screen.h"
 
 extern Memimage		*gscreen;
-int	initscreenimage(void);
-void	_deletescreenimage(void);
 
 static Memsubfont	*memdefont;
 static Lock		screenlock;
@@ -114,27 +112,22 @@
 			continue;
 		}
 		gscreen->clipr = resize.r;
-		_deletescreenimage();
-		initscreenimage();
 		qunlock(&drawlock);
 
 		screenwin();
+		deletescreenimage();
+		resetscreenimage();
+		osmsleep(1000);
 	}
 }
 
 void
-_screenresize(Rectangle r)
+screenresize(Rectangle r)
 {
+	qlock(&drawlock);
 	resize.r = r;
 	resize.f = 1;
 	wakeup(&resize.z);
-}
-
-void
-screenresize(Rectangle r)
-{
-	qlock(&drawlock);
-	_screenresize(r);
 	qunlock(&drawlock);
 }