Module: wine Branch: master Commit: 1261589c2cc68061d4bd9d41a387cd4979d7073c URL: https://source.winehq.org/git/wine.git/?a=commit;h=1261589c2cc68061d4bd9d41a... Author: Ken Thomases <ken(a)codeweavers.com> Date: Wed Dec 11 11:49:47 2019 -0600 winemac: Only manipulate an NSOpenGLContext's view on the main thread. 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(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- 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 5a097a12d2..e60b0b388b 100644 --- a/dlls/winemac.drv/cocoa_opengl.m +++ b/dlls/winemac.drv/cocoa_opengl.m @@ -79,8 +79,10 @@ 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) 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) clearDrawable { NSView* oldView = [self view]; - [super clearDrawable]; + if ([NSThread isMainThread]) + [super clearDrawable]; + else OnMainThread(^{ + [super clearDrawable]; + }); [oldView release]; [self wine_updateBackingSize:NULL];