[PATCH] winemac: Only manipulate an NSOpenGLContext's view on the main thread.
Chip Davis
cdavis at codeweavers.com
Wed Dec 11 11:49:47 CST 2019
From: Ken Thomases <ken at codeweavers.com>
I was seeing a crash due to an assert about manipulating it on a
background thread. I can't recall where I was seeing that. I think it's
new in Catalina.
Signed-off-by: Chip Davis <cdavis at codeweavers.com>
---
Chip's notes: I have also seen this on Mojave.
dlls/winemac.drv/cocoa_opengl.m | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/dlls/winemac.drv/cocoa_opengl.m b/dlls/winemac.drv/cocoa_opengl.m
index 5a097a12d26..e60b0b388b8 100644
--- a/dlls/winemac.drv/cocoa_opengl.m
+++ b/dlls/winemac.drv/cocoa_opengl.m
@@ -79,8 +79,10 @@ - (void) resetSurfaceIfBackingSizeChanged
macdrv_set_view_backing_size((macdrv_view)self.view, view_backing);
NSView* save = self.view;
- [super clearDrawable];
- [super setView:save];
+ OnMainThread(^{
+ [super clearDrawable];
+ [super setView:save];
+ });
shouldClearToBlack = TRUE;
}
}
@@ -122,7 +124,11 @@ - (void) wine_updateBackingSize:(const CGSize*)size
- (void) setView:(NSView*)newView
{
NSView* oldView = [self view];
- [super setView:newView];
+ if ([NSThread isMainThread])
+ [super setView:newView];
+ else OnMainThread(^{
+ [super setView:newView];
+ });
[newView retain];
[oldView release];
}
@@ -130,7 +136,11 @@ - (void) setView:(NSView*)newView
- (void) clearDrawable
{
NSView* oldView = [self view];
- [super clearDrawable];
+ if ([NSThread isMainThread])
+ [super clearDrawable];
+ else OnMainThread(^{
+ [super clearDrawable];
+ });
[oldView release];
[self wine_updateBackingSize:NULL];
--
2.24.0
More information about the wine-devel
mailing list