aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/devdraw
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2019-04-05 15:04:10 -0400
committerRuss Cox <rsc@swtch.com>2019-04-05 15:04:10 -0400
commit26c6b2579543e928158fa7d3c00d8b0e04ac270c (patch)
tree0685764c118ef19c478004c61779aa9d074df1d2 /src/cmd/devdraw
parentdc60de7b64948e89832f03181e6db799060036b8 (diff)
downloadplan9port-26c6b2579543e928158fa7d3c00d8b0e04ac270c.tar.gz
plan9port-26c6b2579543e928158fa7d3c00d8b0e04ac270c.tar.bz2
plan9port-26c6b2579543e928158fa7d3c00d8b0e04ac270c.zip
devdraw: avoid deadlock on pre-Mojave macOS
Diffstat (limited to 'src/cmd/devdraw')
-rw-r--r--src/cmd/devdraw/cocoa-screen.m6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/cmd/devdraw/cocoa-screen.m b/src/cmd/devdraw/cocoa-screen.m
index c2489a6c..97128da2 100644
--- a/src/cmd/devdraw/cocoa-screen.m
+++ b/src/cmd/devdraw/cocoa-screen.m
@@ -541,6 +541,11 @@ _flushmemscreen(Rectangle r)
return;
rect = NSMakeRect(r.min.x, r.min.y, Dx(r), Dy(r));
+
+ // This can get blocked behind responding to mouse events,
+ // which need to acquire the zlock, so let go of it during
+ // the flush. Perhaps the waitUntilDone:YES is wrong?
+ zunlock();
[appdelegate
performSelectorOnMainThread:@selector(callflushimg:)
withObject:[NSValue valueWithRect:rect]
@@ -548,6 +553,7 @@ _flushmemscreen(Rectangle r)
modes:[NSArray arrayWithObjects:
NSRunLoopCommonModes,
@"waiting image", nil]];
+ zlock();
}
static void drawimg(NSRect, uint);