9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] drawterm gui-cocoa/screen.m display() needs a drawlock
@ 2024-01-23  0:19 Xiao-Yong Jin
  0 siblings, 0 replies; only message in thread
From: Xiao-Yong Jin @ 2024-01-23  0:19 UTC (permalink / raw)
  To: 9front

If a screen resize happens between blit command encoding and command
buffer execution, drawterm will crash, because the encoded _texture
gets replaced by screensize() and no longer points to valid memory.
The following patch adds the drawlock to keep _texture consistent.

% diff -u gui-metal/screen.m gui-cocoa/screen.m
--- a/gui-cocoa/screen.m 2024-01-22 17:59:15
+++ b/gui-cocoa/screen.m 2023-08-22 00:20:02
@@ -937,9 +931,6 @@
 	}
 	
 	blit = [cbuf blitCommandEncoder];
+
+	qlock(&drawlock);
+
 	[blit copyFromTexture:_texture
 		sourceSlice:0
 		sourceLevel:0
@@ -961,7 +952,6 @@
 		}else{
 			LOG(@"command buffer finished");
 		}
+		qunlock(&drawlock);
 	}];
 	[cbuf commit];
 }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-23  0:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-23  0:19 [9front] drawterm gui-cocoa/screen.m display() needs a drawlock Xiao-Yong Jin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).