Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS: Dispatch GL calls to main thread to prevent crashes on Catalina #8544

Merged
merged 1 commit into from
Jan 2, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions Source/Core/Common/GL/GLInterface/AGL.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -140,7 +142,10 @@ static bool AttachContextToView(NSOpenGLContext* context, NSView* view, u32* wid
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)
Expand Down