Merge pull request #8544 from gtalusan/master
MacOS: Dispatch GL calls to main thread to prevent crashes on Catalina
This commit is contained in:
commit
a04d4982b1
|
@ -36,10 +36,12 @@ static bool AttachContextToView(NSOpenGLContext* context, NSView* view, u32* wid
|
||||||
|
|
||||||
(void)UpdateCachedDimensions(view, width, height);
|
(void)UpdateCachedDimensions(view, width, height);
|
||||||
|
|
||||||
|
// 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];
|
[window makeFirstResponder:view];
|
||||||
[context setView:view];
|
[context setView:view];
|
||||||
[window makeKeyAndOrderFront:nil];
|
[window makeKeyAndOrderFront:nil];
|
||||||
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +142,10 @@ void GLContextAGL::Update()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (UpdateCachedDimensions(m_view, &m_backbuffer_width, &m_backbuffer_height))
|
if (UpdateCachedDimensions(m_view, &m_backbuffer_width, &m_backbuffer_height))
|
||||||
|
// 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];
|
[m_context update];
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLContextAGL::SwapInterval(int interval)
|
void GLContextAGL::SwapInterval(int interval)
|
||||||
|
|
Loading…
Reference in New Issue