summaryrefslogtreecommitdiff
path: root/Source/Core/Common/GL/GLInterface
diff options
context:
space:
mode:
authorGeorge Talusan <george.talusan@gmail.com>2020-01-01 21:47:55 -0500
committerGeorge Talusan <george.talusan@gmail.com>2020-01-01 23:06:19 -0500
commitb1a6cbc3b4ff4c36fb7da4f6faac59b6b0b23845 (patch)
treeb7349aca416c9f5dcc5d5437ae227768805eabc7 /Source/Core/Common/GL/GLInterface
parent11339d77c6835dd908b86a92412686c46435e006 (diff)
MacOS: Dispatch GL calls to main thread to prevent crashes on Catalina
Diffstat (limited to 'Source/Core/Common/GL/GLInterface')
-rw-r--r--Source/Core/Common/GL/GLInterface/AGL.mm15
1 files changed, 10 insertions, 5 deletions
diff --git a/Source/Core/Common/GL/GLInterface/AGL.mm b/Source/Core/Common/GL/GLInterface/AGL.mm
index ec58625dac..0c8b45e328 100644
--- a/Source/Core/Common/GL/GLInterface/AGL.mm
+++ b/Source/Core/Common/GL/GLInterface/AGL.mm
@@ -36,10 +36,12 @@ static bool AttachContextToView(NSOpenGLContext* context, NSView* view, u32* wid
(void)UpdateCachedDimensions(view, width, height);
- [window makeFirstResponder:view];
- [context setView:view];
- [window makeKeyAndOrderFront:nil];
-
+ // the following calls can crash if not called from the main thread on macOS 10.15
+ dispatch_sync(dispatch_get_main_queue(), ^{
+ [window makeFirstResponder:view];
+ [context setView:view];
+ [window makeKeyAndOrderFront:nil];
+ });
return true;
}
@@ -140,7 +142,10 @@ void GLContextAGL::Update()
return;
if (UpdateCachedDimensions(m_view, &m_backbuffer_width, &m_backbuffer_height))
- [m_context update];
+ // the following calls can crash if not called from the main thread on macOS 10.15
+ dispatch_sync(dispatch_get_main_queue(), ^{
+ [m_context update];
+ });
}
void GLContextAGL::SwapInterval(int interval)